Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellModelWizard.java')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.editor/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/nattablecell/presentation/NattablecellModelWizard.java186
1 files changed, 80 insertions, 106 deletions
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
index c4ce91442ad..fb11da81f31 100644
--- 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
@@ -100,7 +100,6 @@ 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 NattablecellModelWizard extends Wizard implements INewWizard {
@@ -109,7 +108,6 @@ 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$
@@ -118,7 +116,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* 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$
@@ -127,7 +124,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* This caches an instance of the model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected NattablecellPackage nattablecellPackage = NattablecellPackage.eINSTANCE;
@@ -136,7 +132,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* This caches an instance of the model factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected NattablecellFactory nattablecellFactory = nattablecellPackage.getNattablecellFactory();
@@ -145,7 +140,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* This is the file creation page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected NattablecellModelWizardNewFileCreationPage newFileCreationPage;
@@ -154,7 +148,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* This is the initial object creation page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected NattablecellModelWizardInitialObjectCreationPage initialObjectCreationPage;
@@ -163,7 +156,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* Remember the selection during initialization for populating the default container.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected IStructuredSelection selection;
@@ -172,7 +164,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* Remember the workbench during initialization.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected IWorkbench workbench;
@@ -181,7 +172,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* 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;
@@ -190,7 +180,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* This just records the information.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
@@ -204,16 +193,15 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* 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) {
+ if (initialObjectNames == null) {
initialObjectNames = new ArrayList<String>();
- for(EClassifier eClassifier : nattablecellPackage.getEClassifiers()) {
- if(eClassifier instanceof EClass) {
+ for (EClassifier eClassifier : nattablecellPackage.getEClassifiers()) {
+ if (eClassifier instanceof EClass) {
EClass eClass = (EClass)eClassifier;
- if(!eClass.isAbstract()) {
+ if (!eClass.isAbstract()) {
initialObjectNames.add(eClass.getName());
}
}
@@ -227,7 +215,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* Create a new model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected EObject createInitialModel() {
@@ -240,7 +227,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* Do the work after everything is specified.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
@@ -252,42 +238,44 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
// 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);
+ 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();
}
-
- // 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);
@@ -296,27 +284,31 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
final IWorkbenchPart activePart = page.getActivePart();
- if(activePart instanceof ISetSelectionTarget) {
+ if (activePart instanceof ISetSelectionTarget) {
final ISelection targetSelection = new StructuredSelection(modelFile);
- getShell().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
- }
- });
+ 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) {
+ 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) {
+ }
+ catch (Exception exception) {
NattableEditorPlugin.INSTANCE.log(exception);
return false;
}
@@ -326,7 +318,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* This is the one page of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public class NattablecellModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
@@ -335,7 +326,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* Pass in the selection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public NattablecellModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
@@ -346,16 +336,15 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* 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()) {
+ if (super.validatePage()) {
String extension = new Path(getFileName()).getFileExtension();
- if(extension == null || !FILE_EXTENSIONS.contains(extension)) {
+ 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 }));
+ setErrorMessage(NattableEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
return false;
}
return true;
@@ -366,7 +355,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public IFile getModelFile() {
@@ -378,7 +366,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* 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 {
@@ -386,7 +373,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected Combo initialObjectField;
@@ -401,7 +387,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected Combo encodingField;
@@ -410,7 +395,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* Pass in the selection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public NattablecellModelWizardInitialObjectCreationPage(String pageId) {
@@ -420,12 +404,10 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
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,11 +437,11 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
initialObjectField.setLayoutData(data);
}
- for(String objectName : getInitialObjectNames()) {
+ for (String objectName : getInitialObjectNames()) {
initialObjectField.add(getLabel(objectName));
}
- if(initialObjectField.getItemCount() == 1) {
+ if (initialObjectField.getItemCount() == 1) {
initialObjectField.select(0);
}
initialObjectField.addModifyListener(validator);
@@ -480,7 +462,7 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
encodingField.setLayoutData(data);
}
- for(String encoding : getEncodings()) {
+ for (String encoding : getEncodings()) {
encodingField.add(encoding);
}
@@ -494,20 +476,17 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected ModifyListener validator = new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- setPageComplete(validatePage());
- }
- };
+ public void modifyText(ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ };
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected boolean validatePage() {
@@ -517,17 +496,17 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
- if(visible) {
- if(initialObjectField.getItemCount() == 1) {
+ if (visible) {
+ if (initialObjectField.getItemCount() == 1) {
initialObjectField.clearSelection();
encodingField.setFocus();
- } else {
+ }
+ else {
encodingField.clearSelection();
initialObjectField.setFocus();
}
@@ -537,14 +516,13 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public String getInitialObjectName() {
String label = initialObjectField.getText();
- for(String name : getInitialObjectNames()) {
- if(getLabel(name).equals(label)) {
+ for (String name : getInitialObjectNames()) {
+ if (getLabel(name).equals(label)) {
return name;
}
}
@@ -554,7 +532,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public String getEncoding() {
@@ -565,13 +542,13 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* 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) {
+ }
+ catch(MissingResourceException mre) {
NattableEditorPlugin.INSTANCE.log(mre);
}
return typeName;
@@ -580,13 +557,12 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected Collection<String> getEncodings() {
- if(encodings == null) {
+ if (encodings == null) {
encodings = new ArrayList<String>();
- for(StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens();) //$NON-NLS-1$
+ for (StringTokenizer stringTokenizer = new StringTokenizer(NattableEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) //$NON-NLS-1$
{
encodings.add(stringTokenizer.nextToken());
}
@@ -599,7 +575,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
@@ -614,21 +589,21 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
// Try and get the resource selection to determine a current directory for the file dialog.
//
- if(selection != null && !selection.isEmpty()) {
+ if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
- if(selectedElement instanceof IResource) {
+ if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
- if(selectedResource.getType() == IResource.FILE) {
+ if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
- if(selectedResource instanceof IFolder || selectedResource instanceof IProject) {
+ if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
@@ -638,7 +613,7 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
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) {
+ for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$
}
newFileCreationPage.setFileName(modelFilename);
@@ -655,7 +630,6 @@ public class NattablecellModelWizard extends Wizard implements INewWizard {
* Get the file from the page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public IFile getModelFile() {

Back to the top