diff options
author | Vincent Lorenzo | 2018-02-25 14:40:08 +0000 |
---|---|---|
committer | Vincent Lorenzo | 2018-04-10 12:05:56 +0000 |
commit | 88b6509bbd8f5626c12106f63a920613cdbb0a21 (patch) | |
tree | 1b100c65f02eaa2015c1ee0563e3307f07910e9e /plugins/infra | |
parent | 7be80618c31a8f0f6a0cb4f79eca30f00616933c (diff) | |
download | org.eclipse.papyrus-88b6509bbd8f5626c12106f63a920613cdbb0a21.tar.gz org.eclipse.papyrus-88b6509bbd8f5626c12106f63a920613cdbb0a21.tar.xz org.eclipse.papyrus-88b6509bbd8f5626c12106f63a920613cdbb0a21.zip |
Bug 531643: [Table] Remove all table files creation from the Papyrus New Wizard, excepted NattableConfiguration file
- Edit the genmodel, setting generate editor and generate wizard to false for all EPackage, excepted nattableconfiguration package
- Remove all customs editors
- Remove the tests plugins org.eclipse.papyrus.infra.nattable.model.editor.test
- Create a NattableConfigurationResource with the same options than the removed custom editors
- Change path contribution for the NattableConfiguration wizard
- Set nice icons for the NattableConfiguration wizban and the NattableConfiguration resource
Change-Id: I6384e45036a35fe026fcdf2aa65b63d49177159b
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/infra')
59 files changed, 1962 insertions, 12162 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/.classpath b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/.classpath index 5b336cf4f1e..c1f31893de4 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/.classpath +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/.classpath @@ -3,6 +3,5 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src-gen"/> - <classpathentry kind="src" path="custom-src"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/META-INF/MANIFEST.MF index 30a9af51d32..f89e28e4922 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/META-INF/MANIFEST.MF @@ -9,8 +9,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)", org.eclipse.papyrus.infra.types.edit;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf.expressions.edit;bundle-version="[1.0.0,2.0.0)", org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.0.0,2.0.0)" -Export-Package: org.eclipse.papyrus.infra.nattable.model.editor.customeditors, - org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentation, +Export-Package: org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentation, org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.presentation, org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.presentation, org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.presentation, @@ -25,7 +24,7 @@ Export-Package: org.eclipse.papyrus.infra.nattable.model.editor.customeditors, Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-ClassPath: . -Bundle-Version: 4.0.0.qualifier +Bundle-Version: 5.0.0.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-Activator: org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin$Implementation diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableEditor.java deleted file mode 100644 index d59f12cfe39..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * This class allows to override the save options - * - * @author Vincent Lorenzo - * - */ -public class CustomNattableEditor extends NattableEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisEditor.java deleted file mode 100644 index 9ba3e440f82..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentation.NattableaxisEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * This class allows to override the save options - * - * @author Vincent Lorenzo - * - */ -public class CustomNattableaxisEditor extends NattableaxisEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisconfigurationEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisconfigurationEditor.java deleted file mode 100644 index 72c92f99d9e..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisconfigurationEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.presentation.NattableaxisconfigurationEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * This class allows to override the save options - * - * @author Vincent Lorenzo - * - */ -public class CustomNattableaxisconfigurationEditor extends NattableaxisconfigurationEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisproviderEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisproviderEditor.java deleted file mode 100644 index fc3e8ea6395..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableaxisproviderEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.presentation.NattableaxisproviderEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * This class allows to override the save options - * - * @author Vincent Lorenzo - * - */ -public class CustomNattableaxisproviderEditor extends NattableaxisproviderEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablecellEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablecellEditor.java deleted file mode 100644 index 1969a5d4201..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablecellEditor.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.presentation.NattablecellEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -public class CustomNattablecellEditor extends NattablecellEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableconfigurationEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableconfigurationEditor.java deleted file mode 100644 index cf43fcdc5fb..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableconfigurationEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.presentation.NattableconfigurationEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * This class allows to override the save options - * - * @author Vincent Lorenzo - * - */ -public class CustomNattableconfigurationEditor extends NattableconfigurationEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablelabelproviderEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablelabelproviderEditor.java deleted file mode 100644 index d3f91a12983..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablelabelproviderEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.presentation.NattablelabelproviderEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * This class allows to override the save options - * - * @author Vincent Lorenzo - * - */ -public class CustomNattablelabelproviderEditor extends NattablelabelproviderEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableproblemEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableproblemEditor.java deleted file mode 100644 index 9a86e8c0119..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattableproblemEditor.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.presentation.NattableproblemEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -public class CustomNattableproblemEditor extends NattableproblemEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablestyleEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablestyleEditor.java deleted file mode 100644 index 83d60f0cedf..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattablestyleEditor.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.presentation.NattablestyleEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -public class CustomNattablestyleEditor extends NattablestyleEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattabletesterEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattabletesterEditor.java deleted file mode 100644 index 2cdb7d83470..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/custom-src/org/eclipse/papyrus/infra/nattable/model/editor/customeditors/CustomNattabletesterEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 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.model.editor.customeditors; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.presentation.NattabletesterEditor; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * This class allows to override the save options - * - * @author Vincent Lorenzo - * - */ -public class CustomNattabletesterEditor extends NattabletesterEditor { - - /** - * This is for implementing {@link IEditorPart} and simply saves the model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - @Override - public void doSave(IProgressMonitor progressMonitor) { - // Save only resources that have actually changed. - // - final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); - saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - // Do the work within an operation because this is a long running activity that modifies the workbench. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - - // This is the method that gets invoked when the operation runs. - // - @Override - public void execute(IProgressMonitor monitor) { - // Save the resources to the file system. - // - boolean first = true; - for (Resource resource : getEditingDomain().getResourceSet().getResources()) { - if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !getEditingDomain().isReadOnly(resource)) { - try { - long timeStamp = resource.getTimeStamp(); - resource.save(saveOptions); - if (resource.getTimeStamp() != timeStamp) { - savedResources.add(resource); - } - } catch (Exception exception) { - resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); - } - first = false; - } - } - } - }; - this.updateProblemIndication = false; - try { - // This runs the options, and shows progress. - // - new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); - // Refresh the necessary state. - // - ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone(); - firePropertyChange(IEditorPart.PROP_DIRTY); - } catch (Exception exception) { - // Something went wrong that shouldn't. - // - NattableEditorPlugin.INSTANCE.log(exception); - } - this.updateProblemIndication = true; - updateProblemIndication(); - } -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/icons/full/obj16/NattableconfigurationModelFile.gif b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/icons/full/obj16/NattableconfigurationModelFile.gif Binary files differindex 53eb7d4f381..3199667e9b0 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/icons/full/obj16/NattableconfigurationModelFile.gif +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/icons/full/obj16/NattableconfigurationModelFile.gif diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/icons/full/wizban/NewNattableconfiguration.gif b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/icons/full/wizban/NewNattableconfiguration.gif Binary files differindex 5306a816d4c..2a219880b2b 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/icons/full/wizban/NewNattableconfiguration.gif +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/icons/full/wizban/NewNattableconfiguration.gif diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/plugin.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/plugin.properties index ddb291e0a0d..2bf1664caa5 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/plugin.properties +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/plugin.properties @@ -57,8 +57,8 @@ _UI_NattableEditor_label = Nattable Model Editor _UI_NattableEditorFilenameDefaultBase = My _UI_NattableEditorFilenameExtensions = nattable -_UI_NattableconfigurationModelWizard_label = Nattableconfiguration Model -_UI_NattableconfigurationModelWizard_description = Create a new Nattableconfiguration model +_UI_NattableconfigurationModelWizard_label = Table Configuration Model +_UI_NattableconfigurationModelWizard_description = Create a new Table Configuratio Model _UI_NattableconfigurationEditor_label = Nattableconfiguration Model Editor diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/plugin.xml index 78711cfc57a..bfb22710305 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/plugin.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/plugin.xml @@ -16,27 +16,36 @@ <plugin> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableModelWizardID" - name="%_UI_NattableModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattableModelFile.gif"> - <description>%_UI_NattableModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> + + + + + + + + + + + + + + + + + + + + + <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorID" name="%_UI_NattableEditor_label" icon="icons/full/obj16/NattableModelFile.gif" extensions="nattable" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattableEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableActionBarContributor"> </editor> </extension> @@ -47,7 +56,7 @@ id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.presentation.NattableconfigurationModelWizardID" name="%_UI_NattableconfigurationModelWizard_label" class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.presentation.NattableconfigurationModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" + category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.addons.category" icon="icons/full/obj16/NattableconfigurationModelFile.gif"> <description>%_UI_NattableconfigurationModelWizard_description</description> <selection class="org.eclipse.core.resources.IResource"/> @@ -60,223 +69,107 @@ name="%_UI_NattableconfigurationEditor_label" icon="icons/full/obj16/NattableconfigurationModelFile.gif" extensions="nattableconfiguration" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattableconfigurationEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.presentation.NattableconfigurationEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.presentation.NattableconfigurationActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.presentation.NattableaxisproviderModelWizardID" - name="%_UI_NattableaxisproviderModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.presentation.NattableaxisproviderModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattableaxisproviderModelFile.gif"> - <description>%_UI_NattableaxisproviderModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.presentation.NattableaxisproviderEditorID" name="%_UI_NattableaxisproviderEditor_label" icon="icons/full/obj16/NattableaxisproviderModelFile.gif" extensions="nattableaxisprovider" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattableaxisproviderEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.presentation.NattableaxisproviderEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.presentation.NattableaxisproviderActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.presentation.NattablelabelproviderModelWizardID" - name="%_UI_NattablelabelproviderModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.presentation.NattablelabelproviderModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattablelabelproviderModelFile.gif"> - <description>%_UI_NattablelabelproviderModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.presentation.NattablelabelproviderEditorID" name="%_UI_NattablelabelproviderEditor_label" icon="icons/full/obj16/NattablelabelproviderModelFile.gif" extensions="nattablelabelprovider" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattablelabelproviderEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.presentation.NattablelabelproviderEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.presentation.NattablelabelproviderActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.presentation.NattableaxisconfigurationModelWizardID" - name="%_UI_NattableaxisconfigurationModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.presentation.NattableaxisconfigurationModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattableaxisconfigurationModelFile.gif"> - <description>%_UI_NattableaxisconfigurationModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.presentation.NattableaxisconfigurationEditorID" name="%_UI_NattableaxisconfigurationEditor_label" icon="icons/full/obj16/NattableaxisconfigurationModelFile.gif" extensions="nattableaxisconfiguration" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattableaxisconfigurationEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.presentation.NattableaxisconfigurationEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.presentation.NattableaxisconfigurationActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.presentation.NattabletesterModelWizardID" - name="%_UI_NattabletesterModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.presentation.NattabletesterModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattabletesterModelFile.gif"> - <description>%_UI_NattabletesterModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.presentation.NattabletesterEditorID" name="%_UI_NattabletesterEditor_label" icon="icons/full/obj16/NattabletesterModelFile.gif" extensions="nattabletester" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattabletesterEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.presentation.NattabletesterEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.presentation.NattabletesterActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentation.NattableaxisModelWizardID" - name="%_UI_NattableaxisModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentation.NattableaxisModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattableaxisModelFile.gif"> - <description>%_UI_NattableaxisModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentation.NattableaxisEditorID" name="%_UI_NattableaxisEditor_label" icon="icons/full/obj16/NattableaxisModelFile.gif" extensions="nattableaxis" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattableaxisEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentation.NattableaxisEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentation.NattableaxisActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.presentation.NattablecellModelWizardID" - name="%_UI_NattablecellModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.presentation.NattablecellModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattablecellModelFile.gif"> - <description>%_UI_NattablecellModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.presentation.NattablecellEditorID" name="%_UI_NattablecellEditor_label" icon="icons/full/obj16/NattablecellModelFile.gif" extensions="nattablecell" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattablecellEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.presentation.NattablecellEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.presentation.NattablecellActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.presentation.NattableproblemModelWizardID" - name="%_UI_NattableproblemModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.presentation.NattableproblemModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattableproblemModelFile.gif"> - <description>%_UI_NattableproblemModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.presentation.NattableproblemEditorID" name="%_UI_NattableproblemEditor_label" icon="icons/full/obj16/NattableproblemModelFile.gif" extensions="nattableproblem" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattableproblemEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.presentation.NattableproblemEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.presentation.NattableproblemActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.presentation.NattablestyleModelWizardID" - name="%_UI_NattablestyleModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.presentation.NattablestyleModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattablestyleModelFile.gif"> - <description>%_UI_NattablestyleModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> - <!-- @generated NOT nattable --> + <!-- @generated nattable --> <editor id="org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.presentation.NattablestyleEditorID" name="%_UI_NattablestyleEditor_label" icon="icons/full/obj16/NattablestyleModelFile.gif" extensions="nattablestyle" - class="org.eclipse.papyrus.infra.nattable.model.editor.customeditors.CustomNattablestyleEditor" + class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.presentation.NattablestyleEditor" contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.presentation.NattablestyleActionBarContributor"> </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.presentation.NattablecelleditorModelWizardID" - name="%_UI_NattablecelleditorModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.presentation.NattablecelleditorModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattablecelleditorModelFile.gif"> - <description>%_UI_NattablecelleditorModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> <!-- @generated nattable --> <editor @@ -289,19 +182,6 @@ </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated NOT nattable --> - <wizard - id="org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.presentation.NattablewrapperModelWizardID" - name="%_UI_NattablewrapperModelWizard_label" - class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.presentation.NattablewrapperModelWizard" - category="org.eclipse.papyrus.wizards.category/org.eclipse.papyrus.wizards.table.category" - icon="icons/full/obj16/NattablewrapperModelFile.gif"> - <description>%_UI_NattablewrapperModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - <extension point="org.eclipse.ui.editors"> <!-- @generated nattable --> <editor @@ -313,5 +193,4 @@ contributorClass="org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.presentation.NattablewrapperActionBarContributor"> </editor> </extension> - </plugin> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/pom.xml index b6c01aff3af..59f1d669518 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/pom.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/pom.xml @@ -8,6 +8,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>org.eclipse.papyrus.infra.nattable.model.editor</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>5.0.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisActionBarContributor.java index 7dd46e406b1..6cbdc885c5b 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattableaxisActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattableaxisActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattableaxisActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattableaxisActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattableaxisActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisEditor.java index ae11a775a6b..f7dab123ef4 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.presentat import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,117 +34,162 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -153,8 +199,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattableaxisEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -213,56 +259,6 @@ public class NattableaxisEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -310,7 +306,7 @@ public class NattableaxisEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +386,7 @@ public class NattableaxisEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +447,7 @@ public class NattableaxisEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +744,7 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +782,6 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -851,21 +846,6 @@ public class NattableaxisEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -917,7 +897,6 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1021,210 +1000,28 @@ public class NattableaxisEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1061,9 @@ public class NattableaxisEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1079,9 @@ public class NattableaxisEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1107,16 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1196,7 @@ public class NattableaxisEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattableaxisEditor.this.setSelectionToViewer(selection); @@ -1426,34 +1222,22 @@ public class NattableaxisEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1607,7 +1391,6 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1638,12 +1421,7 @@ public class NattableaxisEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1652,7 +1430,6 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1440,6 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1450,6 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1461,6 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1530,6 @@ public class NattableaxisEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1825,6 +1598,6 @@ public class NattableaxisEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisModelWizard.java deleted file mode 100644 index cc3fc0e8c44..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxis/presentation/NattableaxisModelWizard.java +++ /dev/null @@ -1,616 +0,0 @@ -/** - * 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.model.nattable.nattableaxis.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.NattableaxisPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattableaxisModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisPackage nattableaxisPackage = NattableaxisPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisFactory nattableaxisFactory = nattableaxisPackage.getNattableaxisFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattableaxis"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattableaxisPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattableaxisPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattableaxisFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableaxisModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableaxisModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableaxisModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableaxisModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattableaxisModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattableaxisModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationActionBarContributor.java index 63acc3645c9..ef12e57d3b9 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattableaxisconfigurationActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattableaxisconfigurationActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattableaxisconfigurationActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattableaxisconfigurationActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattableaxisconfigurationActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationEditor.java index 5cedb25baff..947aaa1778f 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfigurat import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,117 +34,162 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -153,8 +199,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattableaxisconfigurationEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -213,56 +259,6 @@ public class NattableaxisconfigurationEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -310,7 +306,7 @@ public class NattableaxisconfigurationEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +386,7 @@ public class NattableaxisconfigurationEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +447,7 @@ public class NattableaxisconfigurationEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +744,7 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +782,6 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -851,21 +846,6 @@ public class NattableaxisconfigurationEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -917,7 +897,6 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1021,210 +1000,28 @@ public class NattableaxisconfigurationEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisconfigurationEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisconfigurationEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisconfigurationEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisconfigurationEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisconfigurationEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisconfigurationEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1061,9 @@ public class NattableaxisconfigurationEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1079,9 @@ public class NattableaxisconfigurationEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1107,16 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1196,7 @@ public class NattableaxisconfigurationEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattableaxisconfigurationEditor.this.setSelectionToViewer(selection); @@ -1426,34 +1222,22 @@ public class NattableaxisconfigurationEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1607,7 +1391,6 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1638,12 +1421,7 @@ public class NattableaxisconfigurationEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1652,7 +1430,6 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1440,6 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1450,6 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1461,6 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1530,6 @@ public class NattableaxisconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1825,6 +1598,6 @@ public class NattableaxisconfigurationEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationModelWizard.java deleted file mode 100644 index 6b2b1069963..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisconfiguration/presentation/NattableaxisconfigurationModelWizard.java +++ /dev/null @@ -1,616 +0,0 @@ -/** - * 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.model.nattable.nattableaxisconfiguration.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattableaxisconfigurationModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisconfigurationEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisconfigurationEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisconfigurationPackage nattableaxisconfigurationPackage = NattableaxisconfigurationPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisconfigurationFactory nattableaxisconfigurationFactory = nattableaxisconfigurationPackage.getNattableaxisconfigurationFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisconfigurationModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisconfigurationModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattableaxisconfiguration"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattableaxisconfigurationPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattableaxisconfigurationPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattableaxisconfigurationFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableaxisconfigurationModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableaxisconfigurationModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableaxisconfigurationModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableaxisconfigurationModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattableaxisconfigurationModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisconfigurationModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisconfigurationModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisconfigurationEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisconfigurationEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattableaxisconfigurationModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisconfigurationModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderActionBarContributor.java index f93832b4463..6f6b9962ed9 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattableaxisproviderActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattableaxisproviderActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattableaxisproviderActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattableaxisproviderActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattableaxisproviderActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderEditor.java index d2288b09c9c..2874f8c8e1e 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.p import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,117 +34,162 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -153,8 +199,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattableaxisproviderEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -213,56 +259,6 @@ public class NattableaxisproviderEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -310,7 +306,7 @@ public class NattableaxisproviderEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +386,7 @@ public class NattableaxisproviderEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +447,7 @@ public class NattableaxisproviderEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +744,7 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +782,6 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -851,21 +846,6 @@ public class NattableaxisproviderEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -917,7 +897,6 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1021,210 +1000,28 @@ public class NattableaxisproviderEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableaxisproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1061,9 @@ public class NattableaxisproviderEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1079,9 @@ public class NattableaxisproviderEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1107,16 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1196,7 @@ public class NattableaxisproviderEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattableaxisproviderEditor.this.setSelectionToViewer(selection); @@ -1426,34 +1222,22 @@ public class NattableaxisproviderEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1607,7 +1391,6 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1638,12 +1421,7 @@ public class NattableaxisproviderEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1652,7 +1430,6 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1440,6 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1450,6 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1461,6 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1530,6 @@ public class NattableaxisproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1825,6 +1598,6 @@ public class NattableaxisproviderEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderModelWizard.java deleted file mode 100644 index 477e24fc2a1..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableaxisprovider/presentation/NattableaxisproviderModelWizard.java +++ /dev/null @@ -1,616 +0,0 @@ -/** - * 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.model.nattable.nattableaxisprovider.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattableaxisproviderModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisproviderEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisproviderEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisproviderPackage nattableaxisproviderPackage = NattableaxisproviderPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisproviderFactory nattableaxisproviderFactory = nattableaxisproviderPackage.getNattableaxisproviderFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisproviderModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableaxisproviderModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattableaxisprovider"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattableaxisproviderPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattableaxisproviderPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattableaxisproviderFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableaxisproviderModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableaxisproviderModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableaxisproviderModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableaxisproviderModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattableaxisproviderModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisproviderModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisproviderModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisproviderEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisproviderEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattableaxisproviderModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableaxisproviderModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellActionBarContributor.java index 8131d918a5f..a284736dbe9 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattablecellActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattablecellActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattablecellActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattablecellActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattablecellActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellEditor.java index cd7aff708f3..7131d916693 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.presentat import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,117 +34,162 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -153,8 +199,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattablecellEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -213,56 +259,6 @@ public class NattablecellEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -310,7 +306,7 @@ public class NattablecellEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +386,7 @@ public class NattablecellEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +447,7 @@ public class NattablecellEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +744,7 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +782,6 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -851,21 +846,6 @@ public class NattablecellEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -917,7 +897,6 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1021,210 +1000,28 @@ public class NattablecellEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecellEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecellEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecellEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecellEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecellEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecellEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1061,9 @@ public class NattablecellEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1079,9 @@ public class NattablecellEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1107,16 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1196,7 @@ public class NattablecellEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattablecellEditor.this.setSelectionToViewer(selection); @@ -1426,34 +1222,22 @@ public class NattablecellEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1607,7 +1391,6 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1638,12 +1421,7 @@ public class NattablecellEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1652,7 +1430,6 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1440,6 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1450,6 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1461,6 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1530,6 @@ public class NattablecellEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1825,6 +1598,6 @@ public class NattablecellEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellModelWizard.java deleted file mode 100644 index b68e2cd2a4a..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellModelWizard.java +++ /dev/null @@ -1,616 +0,0 @@ -/** - * 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.model.nattable.nattablecell.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.NattablecellFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.NattablecellPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattablecellModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecellEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattablecellEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablecellPackage nattablecellPackage = NattablecellPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablecellFactory nattablecellFactory = nattablecellPackage.getNattablecellFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablecellModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablecellModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattablecell"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattablecellPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattablecellPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattablecellFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablecellModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablecellModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablecellModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablecellModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattablecellModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecellModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecellModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecellEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattablecellEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattablecellModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecellModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecelleditor/presentation/NattablecelleditorEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecelleditor/presentation/NattablecelleditorEditor.java index ae1381d1a05..671a20e0fcb 100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecelleditor/presentation/NattablecelleditorEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecelleditor/presentation/NattablecelleditorEditor.java @@ -52,17 +52,13 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; @@ -78,15 +74,11 @@ import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.graphics.Point; - -import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorInput; @@ -120,7 +112,6 @@ import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; import org.eclipse.emf.common.ui.editor.ProblemEditorPart; @@ -268,56 +259,6 @@ public class NattablecelleditorEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -905,21 +846,6 @@ public class NattablecelleditorEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -1074,210 +1000,28 @@ public class NattablecelleditorEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecelleditorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecelleditorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecelleditorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecelleditorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecelleditorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablecelleditorEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1317,9 +1061,9 @@ public class NattablecelleditorEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1335,9 +1079,9 @@ public class NattablecelleditorEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1363,17 +1107,16 @@ public class NattablecelleditorEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1453,7 +1196,7 @@ public class NattablecelleditorEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattablecelleditorEditor.this.setSelectionToViewer(selection); @@ -1479,34 +1222,22 @@ public class NattablecelleditorEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1690,12 +1421,7 @@ public class NattablecelleditorEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1872,6 +1598,6 @@ public class NattablecelleditorEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecelleditor/presentation/NattablecelleditorModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecelleditor/presentation/NattablecelleditorModelWizard.java deleted file mode 100755 index c45d598f0e7..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecelleditor/presentation/NattablecelleditorModelWizard.java +++ /dev/null @@ -1,640 +0,0 @@ -/** - * 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.model.nattable.nattablecelleditor.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.emf.common.CommonPlugin; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; - -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.jface.dialogs.MessageDialog; - -import org.eclipse.jface.viewers.IStructuredSelection; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.ModifyEvent; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; - - -import org.eclipse.core.runtime.Path; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; - -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; - -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattablecelleditorModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecelleditorEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattablecelleditorEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablecelleditorPackage nattablecelleditorPackage = NattablecelleditorPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablecelleditorFactory nattablecelleditorFactory = nattablecelleditorPackage.getNattablecelleditorFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablecelleditorModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablecelleditorModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattablecelleditor"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattablecelleditorPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattablecelleditorPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattablecelleditorFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablecelleditorModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablecelleditorModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablecelleditorModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablecelleditorModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattablecelleditorModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecelleditorModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecelleditorModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecelleditorEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattablecelleditorEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattablecelleditorModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablecelleditorModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationActionBarContributor.java index 7deffdf6df0..ba8979a38a5 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattableconfigurationActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattableconfigurationActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattableconfigurationActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattableconfigurationActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattableconfigurationActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationEditor.java index 202d081b1a4..cc483e5797c 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration. import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,57 +34,24 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CommandStack; -import org.eclipse.emf.common.command.CommandStackListener; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; -import org.eclipse.emf.common.ui.editor.ProblemEditorPart; -import org.eclipse.emf.common.ui.viewer.IViewerProvider; -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EContentAdapter; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; -import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; -import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; -import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; -import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; -import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; -import org.eclipse.emf.edit.ui.util.EditUIUtil; -import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; + import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; + import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; + import org.eclipse.jface.util.LocalSelectionTransfer; + import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -97,35 +65,30 @@ import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; + import org.eclipse.swt.SWT; + import org.eclipse.swt.custom.CTabFolder; + import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.Transfer; + import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; + import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + import org.eclipse.swt.layout.FillLayout; + import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeColumn; + import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; @@ -133,18 +96,111 @@ import org.eclipse.ui.IEditorSite; import org.eclipse.ui.IPartListener; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; + import org.eclipse.ui.dialogs.SaveAsDialog; + import org.eclipse.ui.ide.IGotoMarker; + import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.MultiPageEditorPart; + import org.eclipse.ui.views.contentoutline.ContentOutline; import org.eclipse.ui.views.contentoutline.ContentOutlinePage; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + import org.eclipse.ui.views.properties.IPropertySheetPage; import org.eclipse.ui.views.properties.PropertySheet; import org.eclipse.ui.views.properties.PropertySheetPage; +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.command.CommandStackListener; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.ui.MarkerHelper; +import org.eclipse.emf.common.ui.ViewerPane; + +import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; + +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; + + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.emf.ecore.util.EContentAdapter; +import org.eclipse.emf.ecore.util.EcoreUtil; + +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; + +import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + +import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + +import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + +import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; +import org.eclipse.emf.edit.ui.dnd.LocalTransfer; +import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + +import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + +import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; +import org.eclipse.emf.edit.ui.util.EditUIUtil; + +import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + +import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; + +import org.eclipse.ui.actions.WorkspaceModifyOperation; + /** * This is an example of a Nattableconfiguration model editor. @@ -153,8 +209,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattableconfigurationEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -310,7 +366,7 @@ public class NattableconfigurationEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +446,7 @@ public class NattableconfigurationEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +507,7 @@ public class NattableconfigurationEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +804,7 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +842,6 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -917,7 +972,6 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1224,7 +1278,9 @@ public class NattableconfigurationEditor getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1320,9 @@ public class NattableconfigurationEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1338,9 @@ public class NattableconfigurationEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1366,16 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1455,7 @@ public class NattableconfigurationEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattableconfigurationEditor.this.setSelectionToViewer(selection); @@ -1607,7 +1662,6 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1652,7 +1706,6 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1716,6 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1726,6 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1737,6 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1806,6 @@ public class NattableconfigurationEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationModelWizard.java index 35988554e30..bb0096efbe1 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationModelWizard.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableconfiguration/presentation/NattableconfigurationModelWizard.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -23,53 +23,79 @@ import java.util.Map; import java.util.MissingResourceException; import java.util.StringTokenizer; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.CommonPlugin; + import org.eclipse.emf.common.util.URI; + import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; + +import org.eclipse.emf.ecore.EObject; + import org.eclipse.emf.ecore.xmi.XMLResource; + import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; + +import org.eclipse.core.runtime.IProgressMonitor; + import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; + import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; + import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; + import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; + import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.ModifyEvent; + import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; + import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; + import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; + import org.eclipse.ui.dialogs.WizardNewFileCreationPage; + import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.ISetSelectionTarget; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationFactory; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationPackage; +import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; + + +import org.eclipse.core.runtime.Path; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; + +import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; + /** * This is a simple wizard for creating a new model file. @@ -85,7 +111,7 @@ public class NattableconfigurationModelWizard extends Wizard implements INewWiza * @generated */ public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattableconfigurationEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ + Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattableconfigurationEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ /** * A formatted list of supported file extensions, suitable for display. @@ -94,7 +120,7 @@ public class NattableconfigurationModelWizard extends Wizard implements INewWiza * @generated */ public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattableconfigurationEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + NattableEditorPlugin.INSTANCE.getString("_UI_NattableconfigurationEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /** * This caches an instance of the model package. @@ -158,7 +184,6 @@ public class NattableconfigurationModelWizard extends Wizard implements INewWiza * <!-- end-user-doc --> * @generated */ - @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; this.selection = selection; @@ -354,8 +379,8 @@ public class NattableconfigurationModelWizard extends Wizard implements INewWiza /** * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> + * <!-- end-user-doc --> */ protected List<String> encodings; @@ -381,9 +406,9 @@ public class NattableconfigurationModelWizard extends Wizard implements INewWiza * <!-- end-user-doc --> * @generated */ - @Override public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { + Composite composite = new Composite(parent, SWT.NONE); + { GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.verticalSpacing = 12; @@ -455,7 +480,7 @@ public class NattableconfigurationModelWizard extends Wizard implements INewWiza * @generated */ protected ModifyListener validator = - new ModifyListener() { + new ModifyListener() { public void modifyText(ModifyEvent e) { setPageComplete(validatePage()); } @@ -554,7 +579,7 @@ public class NattableconfigurationModelWizard extends Wizard implements INewWiza * <!-- end-user-doc --> * @generated */ - @Override + @Override public void addPages() { // Create a page, set the title, and the initial model file name. // diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderActionBarContributor.java index 56ab5681c25..2fe17d7e4d3 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattablelabelproviderActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattablelabelproviderActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattablelabelproviderActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattablelabelproviderActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattablelabelproviderActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderEditor.java index d2c81e51d03..839b7d54bc6 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider. import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,117 +34,162 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -153,8 +199,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattablelabelproviderEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -213,56 +259,6 @@ public class NattablelabelproviderEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -310,7 +306,7 @@ public class NattablelabelproviderEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +386,7 @@ public class NattablelabelproviderEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +447,7 @@ public class NattablelabelproviderEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +744,7 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +782,6 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -851,21 +846,6 @@ public class NattablelabelproviderEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -917,7 +897,6 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1021,210 +1000,28 @@ public class NattablelabelproviderEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablelabelproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablelabelproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablelabelproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablelabelproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablelabelproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablelabelproviderEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1061,9 @@ public class NattablelabelproviderEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1079,9 @@ public class NattablelabelproviderEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1107,16 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1196,7 @@ public class NattablelabelproviderEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattablelabelproviderEditor.this.setSelectionToViewer(selection); @@ -1426,34 +1222,22 @@ public class NattablelabelproviderEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1607,7 +1391,6 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1638,12 +1421,7 @@ public class NattablelabelproviderEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1652,7 +1430,6 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1440,6 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1450,6 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1461,6 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1530,6 @@ public class NattablelabelproviderEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1825,6 +1598,6 @@ public class NattablelabelproviderEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderModelWizard.java deleted file mode 100644 index 9ff87515b64..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablelabelprovider/presentation/NattablelabelproviderModelWizard.java +++ /dev/null @@ -1,616 +0,0 @@ -/** - * 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.model.nattable.nattablelabelprovider.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.NattablelabelproviderPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattablelabelproviderModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattablelabelproviderEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattablelabelproviderEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablelabelproviderPackage nattablelabelproviderPackage = NattablelabelproviderPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablelabelproviderFactory nattablelabelproviderFactory = nattablelabelproviderPackage.getNattablelabelproviderFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablelabelproviderModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablelabelproviderModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattablelabelprovider"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattablelabelproviderPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattablelabelproviderPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattablelabelproviderFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablelabelproviderModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablelabelproviderModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablelabelproviderModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablelabelproviderModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattablelabelproviderModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablelabelproviderModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattablelabelproviderModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattablelabelproviderEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattablelabelproviderEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattablelabelproviderModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablelabelproviderModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemActionBarContributor.java index 35b076b1061..56bdabf70a2 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattableproblemActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattableproblemActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattableproblemActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattableproblemActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattableproblemActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemEditor.java index 44db5bc2f0c..17b6d71eb1a 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.presen import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,117 +34,162 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -153,8 +199,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattableproblemEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -213,56 +259,6 @@ public class NattableproblemEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -310,7 +306,7 @@ public class NattableproblemEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +386,7 @@ public class NattableproblemEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +447,7 @@ public class NattableproblemEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +744,7 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +782,6 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -851,21 +846,6 @@ public class NattableproblemEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -917,7 +897,6 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1021,210 +1000,28 @@ public class NattableproblemEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableproblemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableproblemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableproblemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableproblemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableproblemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableproblemEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1061,9 @@ public class NattableproblemEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1079,9 @@ public class NattableproblemEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1107,16 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1196,7 @@ public class NattableproblemEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattableproblemEditor.this.setSelectionToViewer(selection); @@ -1426,34 +1222,22 @@ public class NattableproblemEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1607,7 +1391,6 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1638,12 +1421,7 @@ public class NattableproblemEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1652,7 +1430,6 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1440,6 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1450,6 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1461,6 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1530,6 @@ public class NattableproblemEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1825,6 +1598,6 @@ public class NattableproblemEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemModelWizard.java deleted file mode 100644 index a4cfb0079d7..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattableproblem/presentation/NattableproblemModelWizard.java +++ /dev/null @@ -1,616 +0,0 @@ -/** - * 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.model.nattable.nattableproblem.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.NattableproblemFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.NattableproblemPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattableproblemModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattableproblemEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattableproblemEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableproblemPackage nattableproblemPackage = NattableproblemPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableproblemFactory nattableproblemFactory = nattableproblemPackage.getNattableproblemFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableproblemModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableproblemModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattableproblem"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattableproblemPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattableproblemPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattableproblemFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableproblemModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableproblemModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableproblemModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableproblemModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattableproblemModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableproblemModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattableproblemModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattableproblemEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattableproblemEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattableproblemModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableproblemModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleActionBarContributor.java index 4fc28472867..2d1da9bf0fc 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattablestyleActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattablestyleActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattablestyleActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattablestyleActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattablestyleActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleEditor.java index 1a114f17571..beabc34be18 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.presenta import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,117 +34,162 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -153,8 +199,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattablestyleEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -213,56 +259,6 @@ public class NattablestyleEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -310,7 +306,7 @@ public class NattablestyleEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +386,7 @@ public class NattablestyleEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +447,7 @@ public class NattablestyleEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +744,7 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +782,6 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -851,21 +846,6 @@ public class NattablestyleEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -917,7 +897,6 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1021,210 +1000,28 @@ public class NattablestyleEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablestyleEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablestyleEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablestyleEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablestyleEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablestyleEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablestyleEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1061,9 @@ public class NattablestyleEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1079,9 @@ public class NattablestyleEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1107,16 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1196,7 @@ public class NattablestyleEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattablestyleEditor.this.setSelectionToViewer(selection); @@ -1426,34 +1222,22 @@ public class NattablestyleEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1607,7 +1391,6 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1638,12 +1421,7 @@ public class NattablestyleEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1652,7 +1430,6 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1440,6 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1450,6 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1461,6 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1530,6 @@ public class NattablestyleEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1825,6 +1598,6 @@ public class NattablestyleEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleModelWizard.java deleted file mode 100644 index 922fad87a2e..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablestyle/presentation/NattablestyleModelWizard.java +++ /dev/null @@ -1,616 +0,0 @@ -/** - * 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.model.nattable.nattablestyle.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattablestyleModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattablestyleEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattablestyleEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablestylePackage nattablestylePackage = NattablestylePackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablestyleFactory nattablestyleFactory = nattablestylePackage.getNattablestyleFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablestyleModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablestyleModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattablestyle"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattablestylePackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattablestylePackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattablestyleFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablestyleModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablestyleModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablestyleModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablestyleModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattablestyleModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablestyleModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattablestyleModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattablestyleEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattablestyleEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattablestyleModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablestyleModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterActionBarContributor.java index 395bd5b0a19..5d4935792b6 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,13 +38,16 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -52,8 +58,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattabletesterActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -77,7 +83,7 @@ public class NattabletesterActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -98,7 +104,7 @@ public class NattabletesterActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -254,7 +260,6 @@ public class NattabletesterActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -350,7 +355,7 @@ public class NattabletesterActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterEditor.java index 3199778f18a..fa6ddd6d151 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.present import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,117 +34,162 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; + import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -153,8 +199,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattabletesterEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -213,56 +259,6 @@ public class NattabletesterEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -310,7 +306,7 @@ public class NattabletesterEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -390,7 +386,7 @@ public class NattabletesterEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -451,7 +447,7 @@ public class NattabletesterEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -748,7 +744,7 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -786,7 +782,6 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -851,21 +846,6 @@ public class NattabletesterEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -917,7 +897,6 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1021,210 +1000,28 @@ public class NattabletesterEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattabletesterEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattabletesterEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattabletesterEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattabletesterEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattabletesterEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattabletesterEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1264,9 +1061,9 @@ public class NattabletesterEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1282,9 +1079,9 @@ public class NattabletesterEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1310,17 +1107,16 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1400,7 +1196,7 @@ public class NattabletesterEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattabletesterEditor.this.setSelectionToViewer(selection); @@ -1426,34 +1222,22 @@ public class NattabletesterEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1607,7 +1391,6 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1638,12 +1421,7 @@ public class NattabletesterEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1652,7 +1430,6 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1663,7 +1440,6 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1674,7 +1450,6 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1686,7 +1461,6 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1756,7 +1530,6 @@ public class NattabletesterEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1825,6 +1598,6 @@ public class NattabletesterEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterModelWizard.java deleted file mode 100644 index b26226b06a3..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattabletester/presentation/NattabletesterModelWizard.java +++ /dev/null @@ -1,616 +0,0 @@ -/** - * 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.model.nattable.nattabletester.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.NattabletesterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.NattabletesterPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattabletesterModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattabletesterEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattabletesterEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattabletesterPackage nattabletesterPackage = NattabletesterPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattabletesterFactory nattabletesterFactory = nattabletesterPackage.getNattabletesterFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattabletesterModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattabletesterModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattabletester"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattabletesterPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattabletesterPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattabletesterFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattabletesterModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattabletesterModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattabletesterModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattabletesterModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattabletesterModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattabletesterModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattabletesterModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattabletesterEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattabletesterEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattabletesterModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattabletesterModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablewrapper/presentation/NattablewrapperEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablewrapper/presentation/NattablewrapperEditor.java index b24c879a82d..d3eb94e95b2 100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablewrapper/presentation/NattablewrapperEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablewrapper/presentation/NattablewrapperEditor.java @@ -52,17 +52,13 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; @@ -78,15 +74,11 @@ import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.graphics.Point; - -import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorInput; @@ -120,7 +112,6 @@ import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; import org.eclipse.emf.common.ui.editor.ProblemEditorPart; @@ -268,56 +259,6 @@ public class NattablewrapperEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -905,21 +846,6 @@ public class NattablewrapperEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -1074,210 +1000,28 @@ public class NattablewrapperEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablewrapperEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablewrapperEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablewrapperEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablewrapperEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablewrapperEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattablewrapperEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); - - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1317,9 +1061,9 @@ public class NattablewrapperEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1335,9 +1079,9 @@ public class NattablewrapperEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1363,17 +1107,16 @@ public class NattablewrapperEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1453,7 +1196,7 @@ public class NattablewrapperEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattablewrapperEditor.this.setSelectionToViewer(selection); @@ -1479,34 +1222,22 @@ public class NattablewrapperEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1690,12 +1421,7 @@ public class NattablewrapperEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1872,6 +1598,6 @@ public class NattablewrapperEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablewrapper/presentation/NattablewrapperModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablewrapper/presentation/NattablewrapperModelWizard.java deleted file mode 100755 index 9ca157d49af..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablewrapper/presentation/NattablewrapperModelWizard.java +++ /dev/null @@ -1,640 +0,0 @@ -/** - * 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.model.nattable.nattablewrapper.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.emf.common.CommonPlugin; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; - -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.jface.dialogs.MessageDialog; - -import org.eclipse.jface.viewers.IStructuredSelection; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.ModifyEvent; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; - -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.NattablewrapperFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.NattablewrapperPackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; - - -import org.eclipse.core.runtime.Path; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; - -import org.eclipse.papyrus.infra.nattable.model.nattable.presentation.NattableEditorPlugin; - -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattablewrapperModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattablewrapperEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattablewrapperEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablewrapperPackage nattablewrapperPackage = NattablewrapperPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablewrapperFactory nattablewrapperFactory = nattablewrapperPackage.getNattablewrapperFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablewrapperModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablewrapperModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattablewrapper"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattablewrapperPackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattablewrapperPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattablewrapperFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablewrapperModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablewrapperModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattablewrapperModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattablewrapperModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattablewrapperModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablewrapperModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattablewrapperModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattablewrapperEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattablewrapperEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattablewrapperModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattablewrapperModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableActionBarContributor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableActionBarContributor.java index a65191b5643..9e3c9b9738a 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableActionBarContributor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableActionBarContributor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -16,14 +16,17 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; @@ -35,12 +38,14 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; + import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; + import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; @@ -51,8 +56,8 @@ import org.eclipse.ui.PartInitException; * @generated */ public class NattableActionBarContributor - extends EditingDomainActionBarContributor - implements ISelectionChangedListener { + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> @@ -76,7 +81,7 @@ public class NattableActionBarContributor * @generated */ protected IAction showPropertiesViewAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) //$NON-NLS-1$ { @Override public void run() { @@ -97,7 +102,7 @@ public class NattableActionBarContributor * @generated */ protected IAction refreshViewerAction = - new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ + new Action(NattableEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) //$NON-NLS-1$ { @Override public boolean isEnabled() { @@ -253,7 +258,6 @@ public class NattableActionBarContributor * <!-- end-user-doc --> * @generated */ - @Override public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // @@ -349,7 +353,7 @@ public class NattableActionBarContributor } } } - + /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableEditor.java index 964ba41e431..ece8af367fd 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableEditor.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableEditor.java @@ -1,12 +1,12 @@ /** * 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 */ @@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.model.nattable.presentation; import java.io.IOException; import java.io.InputStream; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,116 +34,160 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; + import org.eclipse.emf.common.ui.MarkerHelper; -import org.eclipse.emf.common.ui.ViewerPane; + import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + import org.eclipse.emf.common.ui.viewer.IViewerProvider; + import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + + import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; + import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; + import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; + import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; + import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; + +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.provider.BooleanExpressionsItemProviderAdapterFactory; + +import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider.NattableaxisItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider.NattableaxisconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider.NattableaxisproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.provider.NattablecellItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.provider.NattablecelleditorItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.NattableconfigurationItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.provider.NattablelabelproviderItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.provider.NattableproblemItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.provider.NattablestyleItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.provider.NattabletesterItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.provider.NattablewrapperItemProviderAdapterFactory; + import org.eclipse.papyrus.infra.types.provider.ElementTypesConfigurationsItemProviderAdapterFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableItemProviderAdapterFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.FileTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; + import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheet; -import org.eclipse.ui.views.properties.PropertySheetPage; /** @@ -152,8 +197,8 @@ import org.eclipse.ui.views.properties.PropertySheetPage; * @generated */ public class NattableEditor - extends MultiPageEditorPart - implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> @@ -212,56 +257,6 @@ public class NattableEditor protected TreeViewer selectionViewer; /** - * This inverts the roll of parent and child in the content provider and show parents as a tree. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer parentViewer; - - /** - * This shows how a tree view works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewer; - - /** - * This shows how a list view works. - * A list viewer doesn't support icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListViewer listViewer; - - /** - * This shows how a table view works. - * A table can be used as a list with icons. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TableViewer tableViewer; - - /** - * This shows how a tree view with columns works. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeViewer treeViewerWithColumns; - - /** - * This keeps track of the active viewer pane, in the book. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ViewerPane currentViewerPane; - - /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -309,7 +304,7 @@ public class NattableEditor * @generated */ protected IPartListener partListener = - new IPartListener() { + new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { @@ -389,7 +384,7 @@ public class NattableEditor * @generated */ protected EContentAdapter problemIndicationAdapter = - new EContentAdapter() { + new EContentAdapter() { protected boolean dispatching; @Override @@ -450,7 +445,7 @@ public class NattableEditor * @generated */ protected IResourceChangeListener resourceChangeListener = - new IResourceChangeListener() { + new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { @@ -747,7 +742,7 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override + @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } @@ -785,7 +780,6 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override public EditingDomain getEditingDomain() { return editingDomain; } @@ -850,21 +844,6 @@ public class NattableEditor } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCurrentViewerPane(ViewerPane viewerPane) { - if (currentViewerPane != viewerPane) { - if (currentViewerPane != null) { - currentViewerPane.showFocus(false); - } - currentViewerPane = viewerPane; - } - setCurrentViewer(currentViewerPane.getViewer()); - } - - /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> @@ -916,7 +895,6 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override public Viewer getViewer() { return currentViewer; } @@ -1020,210 +998,28 @@ public class NattableEditor if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - selectionViewer = (TreeViewer)viewerPane.getViewer(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - selectionViewer.setUseHashlookup(true); - - selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - selectionViewer.setInput(editingDomain.getResourceSet()); - selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - viewerPane.setTitle(editingDomain.getResourceSet()); - - new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - - createContextMenuFor(selectionViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ - } - - // Create a page for the parent tree view. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - Tree tree = new Tree(composite, SWT.MULTI); - TreeViewer newTreeViewer = new TreeViewer(tree); - return newTreeViewer; - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - - parentViewer = (TreeViewer)viewerPane.getViewer(); - parentViewer.setAutoExpandLevel(30); - parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); - parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(parentViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ - } - - // This is the page for the list viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new ListViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - listViewer = (ListViewer)viewerPane.getViewer(); - listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(listViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ - } - - // This is the page for the tree viewer - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - treeViewer = (TreeViewer)viewerPane.getViewer(); - treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); - - createContextMenuFor(treeViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TableViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); - tableViewer = (TableViewer)viewerPane.getViewer(); - - Table table = tableViewer.getTable(); - TableLayout layout = new TableLayout(); - table.setLayout(layout); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableColumn objectColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(3, 100, true)); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - - TableColumn selfColumn = new TableColumn(table, SWT.NONE); - layout.addColumnData(new ColumnWeightData(2, 100, true)); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - - tableViewer.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(tableViewer); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ - } - - // This is the page for the table tree viewer. - // - { - ViewerPane viewerPane = - new ViewerPane(getSite().getPage(), NattableEditor.this) { - @Override - public Viewer createViewer(Composite composite) { - return new TreeViewer(composite); - } - @Override - public void requestActivation() { - super.requestActivation(); - setCurrentViewerPane(this); - } - }; - viewerPane.createControl(getContainer()); + Tree tree = new Tree(getContainer(), SWT.MULTI); + selectionViewer = new TreeViewer(tree); + setCurrentViewer(selectionViewer); - treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); + selectionViewer.setUseHashlookup(true); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); - Tree tree = treeViewerWithColumns.getTree(); - tree.setLayoutData(new FillLayout()); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); - TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); - objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ - objectColumn.setResizable(true); - objectColumn.setWidth(250); - - TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); - selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ - selfColumn.setResizable(true); - selfColumn.setWidth(200); - - treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$ - treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); - treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); - - createContextMenuFor(treeViewerWithColumns); - int pageIndex = addPage(viewerPane.getControl()); - setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ - } + createContextMenuFor(selectionViewer); + int pageIndex = addPage(tree); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { - setActivePage(0); + if (!getContainer().isDisposed()) { + setActivePage(0); + } } }); } @@ -1263,9 +1059,9 @@ public class NattableEditor if (getPageCount() <= 1) { setPageText(0, ""); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y + 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); } } } @@ -1281,9 +1077,9 @@ public class NattableEditor if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ if (getContainer() instanceof CTabFolder) { - ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); - getContainer().setSize(point.x, point.y - 6); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); } } } @@ -1309,17 +1105,16 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("rawtypes") @Override - public Object getAdapter(Class key) { + public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { - return showOutlineView() ? getContentOutlinePage() : null; + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; } else if (key.equals(IPropertySheetPage.class)) { - return getPropertySheetPage(); + return key.cast(getPropertySheetPage()); } else if (key.equals(IGotoMarker.class)) { - return this; + return key.cast(this); } else { return super.getAdapter(key); @@ -1399,7 +1194,7 @@ public class NattableEditor */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { @Override public void setSelectionToViewer(List<?> selection) { NattableEditor.this.setSelectionToViewer(selection); @@ -1425,34 +1220,22 @@ public class NattableEditor * @generated */ public void handleContentOutlineSelection(ISelection selection) { - if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); - // If it's the selection viewer, then we want it to select the same selection as this selection. - // - if (currentViewerPane.getViewer() == selectionViewer) { - ArrayList<Object> selectionList = new ArrayList<Object>(); - selectionList.add(selectedElement); - while (selectedElements.hasNext()) { - selectionList.add(selectedElements.next()); - } - - // Set the selection to the widget. - // - selectionViewer.setSelection(new StructuredSelection(selectionList)); - } - else { - // Set the input to the widget. - // - if (currentViewerPane.getViewer().getInput() != selectedElement) { - currentViewerPane.getViewer().setInput(selectedElement); - currentViewerPane.setTitle(selectedElement); - } + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); } } } @@ -1606,7 +1389,6 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { @@ -1637,12 +1419,7 @@ public class NattableEditor */ @Override public void setFocus() { - if (currentViewerPane != null) { - currentViewerPane.setFocus(); - } - else { - getControl(getActivePage()).setFocus(); - } + getControl(getActivePage()).setFocus(); } /** @@ -1651,7 +1428,6 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } @@ -1662,7 +1438,6 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } @@ -1673,7 +1448,6 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override public ISelection getSelection() { return editorSelection; } @@ -1685,7 +1459,6 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override public void setSelection(ISelection selection) { editorSelection = selection; @@ -1755,7 +1528,6 @@ public class NattableEditor * <!-- end-user-doc --> * @generated */ - @Override public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } @@ -1824,6 +1596,6 @@ public class NattableEditor * @generated */ protected boolean showOutlineView() { - return true; + return false; } } diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableEditorPlugin.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableEditorPlugin.java index f38d64bb595..f491002f401 100644..100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableEditorPlugin.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableEditorPlugin.java @@ -1,22 +1,27 @@ /** * 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.model.nattable.presentation; import org.eclipse.emf.common.EMFPlugin; + import org.eclipse.emf.common.ui.EclipseUIPlugin; + import org.eclipse.emf.common.util.ResourceLocator; + import org.eclipse.emf.ecore.provider.EcoreEditPlugin; + import org.eclipse.papyrus.infra.emf.expressions.provider.ExpressionsEditPlugin; + import org.eclipse.papyrus.infra.types.provider.TypesConfigurationsEditPlugin; /** @@ -33,7 +38,7 @@ public final class NattableEditorPlugin extends EMFPlugin { * @generated */ public static final NattableEditorPlugin INSTANCE = new NattableEditorPlugin(); - + /** * Keep track of the singleton. * <!-- begin-user-doc --> @@ -68,7 +73,7 @@ public final class NattableEditorPlugin extends EMFPlugin { public ResourceLocator getPluginResourceLocator() { return plugin; } - + /** * Returns the singleton instance of the Eclipse plugin. * <!-- begin-user-doc --> @@ -79,7 +84,7 @@ public final class NattableEditorPlugin extends EMFPlugin { public static Implementation getPlugin() { return plugin; } - + /** * The actual implementation of the Eclipse <b>Plugin</b>. * <!-- begin-user-doc --> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableModelWizard.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableModelWizard.java deleted file mode 100644 index 9d73577772d..00000000000 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/presentation/NattableModelWizard.java +++ /dev/null @@ -1,615 +0,0 @@ -/** - * 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.model.nattable.presentation; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.papyrus.infra.nattable.model.nattable.NattableFactory; -import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage; -import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - - -/** - * This is a simple wizard for creating a new model file. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class NattableModelWizard extends Wizard implements INewWizard { - /** - * The supported extensions for created files. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<String> FILE_EXTENSIONS = - Collections.unmodifiableList(Arrays.asList(NattableEditorPlugin.INSTANCE.getString("_UI_NattableEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * A formatted list of supported file extensions, suitable for display. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String FORMATTED_FILE_EXTENSIONS = - NattableEditorPlugin.INSTANCE.getString("_UI_NattableEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * This caches an instance of the model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattablePackage nattablePackage = NattablePackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableFactory nattableFactory = nattablePackage.getNattableFactory(); - - /** - * This is the file creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NattableModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NattableEditorPlugin.INSTANCE.getImage("full/wizban/NewNattable"))); //$NON-NLS-1$ - } - - /** - * Returns the names of the types that can be created as the root object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (EClassifier eClassifier : nattablePackage.getEClassifiers()) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass)eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); - } - return initialObjectNames; - } - - /** - * Create a new model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObject createInitialModel() { - EClass eClass = (EClass)nattablePackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = nattableFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), NattableEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - NattableEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected boolean validatePage() { - if (super.validatePage()) { - String extension = new Path(getFileName()).getFileExtension(); - if (extension == null || !FILE_EXTENSIONS.contains(extension)) { - String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ - setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); - return false; - } - return true; - } - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public class NattableModelWizardInitialObjectCreationPage extends WizardPage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo initialObjectField; - - /** - * @generated - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - protected List<String> encodings; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Combo encodingField; - - /** - * Pass in the selection. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NattableModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (String objectName : getInitialObjectNames()) { - initialObjectField.add(getLabel(objectName)); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (String encoding : getEncodings()) { - encodingField.add(encoding); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModifyListener validator = - new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } - else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (String name : getInitialObjectNames()) { - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected String getLabel(String typeName) { - try { - return NattableEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ - } - catch(MissingResourceException mre) { - NattableEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$ - { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new NattableModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ - newFileCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableModelWizard_label")); //$NON-NLS-1$ - newFileCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_NattableModelWizard_description")); //$NON-NLS-1$ - newFileCreationPage.setFileName(NattableEditorPlugin.INSTANCE.getString("_UI_NattableEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if its a file. - // - IResource selectedResource = (IResource)selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = NattableEditorPlugin.INSTANCE.getString("_UI_NattableEditorFilenameDefaultBase"); //$NON-NLS-1$ - String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new NattableModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ - initialObjectCreationPage.setTitle(NattableEditorPlugin.INSTANCE.getString("_UI_NattableModelWizard_label")); //$NON-NLS-1$ - initialObjectCreationPage.setDescription(NattableEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } - -} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/META-INF/MANIFEST.MF index 114cf288f10..5f783231462 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/META-INF/MANIFEST.MF @@ -40,11 +40,12 @@ Export-Package: org.eclipse.papyrus.infra.nattable.model, org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper, org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.impl, org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.util, - org.eclipse.papyrus.infra.nattable.model.nattable.util + org.eclipse.papyrus.infra.nattable.model.nattable.util, + org.eclipse.papyrus.internal.infra.nattable.model.resources Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-ClassPath: . -Bundle-Version: 4.0.0.qualifier +Bundle-Version: 4.1.0.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-Activator: org.eclipse.papyrus.infra.nattable.model.Activator diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/model/nattable.genmodel b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/model/nattable.genmodel index d16345d5933..0e4e8bbcb7b 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/model/nattable.genmodel +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/model/nattable.genmodel @@ -9,7 +9,8 @@ operationReflection="true" importOrganizing="true"> <foreignModel>nattable.ecore</foreignModel> <genPackages prefix="Nattable" basePackage="org.eclipse.papyrus.infra.nattable.model" - disposableProviderFactory="true" ecorePackage="nattable.ecore#/"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#/"> <genClasses ecoreClass="nattable.ecore#//Table"> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nattable.ecore#//Table/context"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nattable.ecore#//Table/owner"/> @@ -54,7 +55,8 @@ </genClasses> </nestedGenPackages> <nestedGenPackages prefix="Nattableaxisprovider" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattableaxisprovider"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattableaxisprovider"> <genClasses image="false" ecoreClass="nattable.ecore#//nattableaxisprovider/AbstractAxisProvider"> <genOperations ecoreOperation="nattable.ecore#//nattableaxisprovider/AbstractAxisProvider/getAxis"/> </genClasses> @@ -70,7 +72,8 @@ <genClasses ecoreClass="nattable.ecore#//nattableaxisprovider/MasterObjectAxisProvider"/> </nestedGenPackages> <nestedGenPackages prefix="Nattablelabelprovider" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattablelabelprovider"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattablelabelprovider"> <genClasses image="false" ecoreClass="nattable.ecore#//nattablelabelprovider/ILabelProviderConfiguration"/> <genClasses ecoreClass="nattable.ecore#//nattablelabelprovider/FeatureLabelProviderConfiguration"> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute nattable.ecore#//nattablelabelprovider/FeatureLabelProviderConfiguration/displayIsDerived"/> @@ -89,7 +92,8 @@ </genClasses> </nestedGenPackages> <nestedGenPackages prefix="Nattableaxisconfiguration" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattableaxisconfiguration"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattableaxisconfiguration"> <genEnums typeSafeEnumCompatible="false" ecoreEnum="nattable.ecore#//nattableaxisconfiguration/AxisIndexStyle"> <genEnumLiterals ecoreEnumLiteral="nattable.ecore#//nattableaxisconfiguration/AxisIndexStyle/ALPHABETIC"/> <genEnumLiterals ecoreEnumLiteral="nattable.ecore#//nattableaxisconfiguration/AxisIndexStyle/NUMERIC"/> @@ -155,7 +159,8 @@ </genClasses> </nestedGenPackages> <nestedGenPackages prefix="Nattabletester" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattabletester"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattabletester"> <genClasses image="false" ecoreClass="nattable.ecore#//nattabletester/AbstractTableTester"> <genOperations ecoreOperation="nattable.ecore#//nattabletester/AbstractTableTester/getTester"/> </genClasses> @@ -164,7 +169,8 @@ </genClasses> </nestedGenPackages> <nestedGenPackages prefix="Nattableaxis" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattableaxis"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattableaxis"> <genClasses image="false" ecoreClass="nattable.ecore#//nattableaxis/IAxis"> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nattable.ecore#//nattableaxis/IAxis/manager"/> @@ -220,7 +226,8 @@ </genClasses> </nestedGenPackages> <nestedGenPackages prefix="Nattablecell" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattablecell"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattablecell"> <genClasses ecoreClass="nattable.ecore#//nattablecell/Cell"> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nattable.ecore#//nattablecell/Cell/columnWrapper"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference nattable.ecore#//nattablecell/Cell/rowWrapper"/> @@ -238,7 +245,8 @@ </genClasses> </nestedGenPackages> <nestedGenPackages prefix="Nattableproblem" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattableproblem"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattableproblem"> <genClasses ecoreClass="nattable.ecore#//nattableproblem/Problem"/> <genClasses ecoreClass="nattable.ecore#//nattableproblem/StringResolutionProblem"> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute nattable.ecore#//nattableproblem/StringResolutionProblem/valueAsString"/> @@ -246,7 +254,8 @@ </genClasses> </nestedGenPackages> <nestedGenPackages prefix="Nattablestyle" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattablestyle"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattablestyle"> <genEnums typeSafeEnumCompatible="false" ecoreEnum="nattable.ecore#//nattablestyle/CellTextAlignment"> <genEnumLiterals ecoreEnumLiteral="nattable.ecore#//nattablestyle/CellTextAlignment/TOP_LEFT"/> <genEnumLiterals ecoreEnumLiteral="nattable.ecore#//nattablestyle/CellTextAlignment/TOP_CENTER"/> @@ -329,7 +338,8 @@ </genClasses> </nestedGenPackages> <nestedGenPackages prefix="Nattablecelleditor" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattablecelleditor"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattablecelleditor"> <genEnums typeSafeEnumCompatible="false" ecoreEnum="nattable.ecore#//nattablecelleditor/MatrixRelationShipDirection"> <genEnumLiterals ecoreEnumLiteral="nattable.ecore#//nattablecelleditor/MatrixRelationShipDirection/NONE"/> <genEnumLiterals ecoreEnumLiteral="nattable.ecore#//nattablecelleditor/MatrixRelationShipDirection/FROM_ROW_TO_COLUMN"/> @@ -348,7 +358,8 @@ <genClasses image="false" ecoreClass="nattable.ecore#//nattablecelleditor/IMatrixCellEditorConfiguration"/> </nestedGenPackages> <nestedGenPackages prefix="Nattablewrapper" basePackage="org.eclipse.papyrus.infra.nattable.model.nattable" - disposableProviderFactory="true" ecorePackage="nattable.ecore#//nattablewrapper"> + disposableProviderFactory="true" multipleEditorPages="false" generateModelWizard="false" + ecorePackage="nattable.ecore#//nattablewrapper"> <genClasses image="false" ecoreClass="nattable.ecore#//nattablewrapper/IWrapper"> <genOperations ecoreOperation="nattable.ecore#//nattablewrapper/IWrapper/getElement"/> </genClasses> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/plugin.xml index 79d9d6c89fc..20dc8322fb0 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/plugin.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/plugin.xml @@ -111,5 +111,12 @@ class="org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.NattablewrapperPackage" genModel="model/nattable.genmodel"/> </extension> + <extension + point="org.eclipse.emf.ecore.extension_parser"> + <parser + class="org.eclipse.papyrus.internal.infra.nattable.model.resources.NattableConfigurationResourceFactory" + type="nattableconfiguration"> + </parser> + </extension> </plugin> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/pom.xml index 08b5417c6a7..1f96d409659 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/pom.xml +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/pom.xml @@ -8,6 +8,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>org.eclipse.papyrus.infra.nattable.model</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/src/org/eclipse/papyrus/internal/infra/nattable/model/resources/NattableConfigurationResource.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/src/org/eclipse/papyrus/internal/infra/nattable/model/resources/NattableConfigurationResource.java new file mode 100755 index 00000000000..3c51da18da0 --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/src/org/eclipse/papyrus/internal/infra/nattable/model/resources/NattableConfigurationResource.java @@ -0,0 +1,97 @@ +/***************************************************************************** + * Copyright (c) 2018 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) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.internal.infra.nattable.model.resources; + +import java.io.IOException; +import java.util.Map; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; + +/** + * @author Vincent LORENZO + * @since 4.1 + */ +public class NattableConfigurationResource extends XMIResourceImpl { + + /** + * the extension of the table configuration file + */ + public static final String NATTABLE_CONFIGURATION_RESOURCE_FILE_EXTENSION = "nattableconfiguration"; //$NON-NLS-1$ + + /** + * + * Constructor. + * + * @param uri + */ + public NattableConfigurationResource(final URI uri) { + super(uri); + } + + /** + * @see org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#useUUIDs() + * + * @return + */ + + @Override + protected boolean useUUIDs() { + return false; // currently, will be done using new resource EMF + } + + /** + * + * @see org.eclipse.emf.ecore.resource.impl.ResourceImpl#save(java.util.Map) + * + * @param options + * @throws IOException + */ + @Override + public final void save(Map<?, ?> options) throws IOException { + super.save(getDefaultSaveOptions());// we bypass the options argument to avoid changes between editors (ExpressionEditor, Ecore Sample Reflexive Editor and Ecore Editor + } + + /** + * @see org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#getDefaultSaveOptions() + * + * @return + */ + @Override + public Map<Object, Object> getDefaultSaveOptions() { + if (null == this.defaultSaveOptions) { + final Map<Object, Object> saveOptions = super.getDefaultSaveOptions(); + saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); + saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); + saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); + } + return this.defaultSaveOptions; + } + + /** + * @see org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#getDefaultLoadOptions() + * + * @return + */ + + @Override + public Map<Object, Object> getDefaultLoadOptions() { + if (null == this.defaultLoadOptions) { + super.getDefaultLoadOptions(); + } + return this.defaultLoadOptions; + } +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/src/org/eclipse/papyrus/internal/infra/nattable/model/resources/NattableConfigurationResourceFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/src/org/eclipse/papyrus/internal/infra/nattable/model/resources/NattableConfigurationResourceFactory.java new file mode 100755 index 00000000000..c3ea4336792 --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model/src/org/eclipse/papyrus/internal/infra/nattable/model/resources/NattableConfigurationResourceFactory.java @@ -0,0 +1,31 @@ +/***************************************************************************** + * Copyright (c) 2018 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) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.internal.infra.nattable.model.resources; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.Resource.Factory; + +/** + * @author Vincent LORENZO + * @since 4.1 + */ +public class NattableConfigurationResourceFactory implements Factory { + + @Override + public Resource createResource(final URI uri) { + return new NattableConfigurationResource(uri); + } + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableConfigurationConstants.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableConfigurationConstants.java index 924025d2154..ff74f8ac410 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableConfigurationConstants.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableConfigurationConstants.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 CEA LIST and others. + * Copyright (c) 2016, 2018 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 @@ -13,6 +13,8 @@ package org.eclipse.papyrus.infra.nattable.utils; +import org.eclipse.papyrus.internal.infra.nattable.model.resources.NattableConfigurationResource; + /** * @author Vincent Lorenzo * @@ -21,6 +23,9 @@ public class NattableConfigurationConstants { /** * The extension for the nattable configuration file. + * @deprecated since 6.0.0, use NattableConfigurationResource.NATTABLE_CONFIGURATION_RESOURCE_FILE_EXTENSION instead + * */ - public static final String NATTABLE_CONFIGURATION_EXTENSION_FILE = "nattableconfiguration"; //$NON-NLS-1$ + @Deprecated + public static final String NATTABLE_CONFIGURATION_EXTENSION_FILE = NattableConfigurationResource.NATTABLE_CONFIGURATION_RESOURCE_FILE_EXTENSION; } |