public class NewModelFileCreationPage<T extends IMetaModelDescriptor>
extends org.eclipse.ui.dialogs.WizardNewFileCreationPage
This page may be used by clients as it is; it may also be subclassed to suit. Subclasses may override validatePage(), getFileExtensionErrorMessage(), getRequiredProjectNatureErrorMessage(), hasRequiredProjectNature(), setVisible(), getDefaultFileExtension(), etc.
Modifier and Type | Field and Description |
---|---|
protected InitialModelProperties<T> |
initialModelProperties |
protected IProjectWorkspacePreference<T> |
metaModelVersionPreference |
protected boolean |
noValidFileExtensionsForContentTypeIdFoundProblemLoggedOnce |
protected org.eclipse.jface.viewers.IStructuredSelection |
selection |
Constructor and Description |
---|
NewModelFileCreationPage(java.lang.String pageId,
org.eclipse.jface.viewers.IStructuredSelection selection,
InitialModelProperties<T> initialModelProperties)
Creates a new instance of new model file creation wizard page.
|
NewModelFileCreationPage(java.lang.String pageId,
org.eclipse.jface.viewers.IStructuredSelection selection,
IProjectWorkspacePreference<T> metaModelVersionPreference)
Creates a new instance of the new model file creation wizard page.
|
NewModelFileCreationPage(java.lang.String pageId,
org.eclipse.jface.viewers.IStructuredSelection selection,
IProjectWorkspacePreference<T> metaModelVersionPreference,
InitialModelProperties<T> initialModelProperties)
Creates a new instance of new model file creation wizard page.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
convertFileExtensionsToString(java.util.Collection<java.lang.String> fileExtensions)
Converts the given collection of file extensions into a string.
|
protected void |
createAdditionalControls(org.eclipse.swt.widgets.Composite parent)
Creates controls for specific project creation options to be placed behind those for file name, container and
advanced options (which are created by
WizardNewFileCreationPage.createControl(Composite) ). |
void |
createControl(org.eclipse.swt.widgets.Composite parent) |
protected java.lang.String |
createFileName(java.lang.String baseName,
java.lang.String extension,
int number)
Creates a name for the new file to be created using provided base name, extension and number.
|
org.eclipse.core.resources.IProject |
getContainerProject()
Returns the project behind the containing resource as entered or selected by the user.
|
protected java.lang.String |
getContentTypeId()
Returns the content type identifier for the metamodel descriptor behind the new model file properties
|
protected java.lang.String |
getDefaultBaseName()
Gets the default base name of the new file, a string "default" by default.
|
protected java.lang.String |
getDefaultFileExtension()
Returns the default file extension of the new model file to be created.
|
protected java.lang.String |
getFileExtensionErrorMessage(java.util.Collection<java.lang.String> validFileExtensions) |
protected java.lang.String |
getMatchingMetaModelVersionErrorMessage() |
protected T |
getMetaModelDescriptor()
Returns the
metamodel descriptor of the new file to be created. |
protected java.lang.String |
getMetaModelName() |
org.eclipse.core.resources.IFile |
getNewFile()
Returns the new file behind the current file name as entered or selected by the user.
|
protected java.lang.String |
getRequiredProjectNatureErrorMessage() |
protected java.lang.String |
getRequiredProjectTypeName() |
protected java.lang.String |
getUniqueDefaultFileName(org.eclipse.core.resources.IContainer container)
Returns a unique default name for the new file to be created which is composed of its
default base name and the default extension . |
protected java.util.Collection<java.lang.String> |
getValidFileExtensions()
Returns the valid file extensions for model files.
|
protected boolean |
hasMatchingMetaModelVersion(org.eclipse.core.resources.IProject project)
Checks if the metamodel version of the specified project matches that of the model file to
be created
|
protected boolean |
hasRequiredProjectNature(org.eclipse.core.resources.IProject project)
Checks if the specified project has the required nature that
has been provided to this NewModelFileCreationPage.
|
void |
setRequiredProjectTypeName(java.lang.String requiredProjectTypeName) |
void |
setVisible(boolean visible) |
protected boolean |
validatePage() |
createAdvancedControls, createFile, createFileHandle, createLinkTarget, createNewFile, createRule, getContainerFullPath, getFileExtension, getFileName, getInitialContents, getNewFileLabel, handleAdvancedButtonSelect, handleEvent, initialPopulateContainerNameField, setAllowExistingResources, setContainerFullPath, setFileExtension, setFileName, validateLinkedResource
canFlipToNextPage, getContainer, getDialogSettings, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isCurrentPage, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setButtonLayoutData, setControl, setMessage
protected org.eclipse.jface.viewers.IStructuredSelection selection
protected IProjectWorkspacePreference<T extends IMetaModelDescriptor> metaModelVersionPreference
protected InitialModelProperties<T extends IMetaModelDescriptor> initialModelProperties
protected boolean noValidFileExtensionsForContentTypeIdFoundProblemLoggedOnce
public NewModelFileCreationPage(java.lang.String pageId, org.eclipse.jface.viewers.IStructuredSelection selection, IProjectWorkspacePreference<T> metaModelVersionPreference)
pageId
- the name of the pageselection
- the current resource selectionmetaModelVersionPreference
- the metamodel version preferencepublic NewModelFileCreationPage(java.lang.String pageId, org.eclipse.jface.viewers.IStructuredSelection selection, InitialModelProperties<T> initialModelProperties)
pageId
- the name of the pageselection
- the current resource selectioninitialModelProperties
- the chosen initial model properties (metamodel, EPackage and
EClassifier) to be used as basis for creating the initial model of the new model filepublic NewModelFileCreationPage(java.lang.String pageId, org.eclipse.jface.viewers.IStructuredSelection selection, IProjectWorkspacePreference<T> metaModelVersionPreference, InitialModelProperties<T> initialModelProperties)
pageId
- the name of the pageselection
- the current resource selectionmetaModelVersionPreference
- the metamodel version preferenceinitialModelProperties
- the chosen initial model properties (metamodel, EPackage and
EClassifier) to be used as basis for creating the initial model of the new model filepublic void createControl(org.eclipse.swt.widgets.Composite parent)
createControl
in interface org.eclipse.jface.dialogs.IDialogPage
createControl
in class org.eclipse.ui.dialogs.WizardNewFileCreationPage
protected void createAdditionalControls(org.eclipse.swt.widgets.Composite parent)
WizardNewFileCreationPage.createControl(Composite)
).
This implementation does nothing.
This method may be overridden by subclasses to provide custom implementations.parent
- the parent compositeWizardNewFileCreationPage.createControl(Composite)
public org.eclipse.core.resources.IProject getContainerProject()
null
if it is not yet knownpublic org.eclipse.core.resources.IFile getNewFile()
null
if it is not yet knownprotected java.lang.String getUniqueDefaultFileName(org.eclipse.core.resources.IContainer container)
default base name
and the default extension
. If
this file name already exists new file names are generated by appending an integer number to the default base
name (or to the default extension if the default base name is omitted) until a new file name has been found that
is not yet used.protected java.lang.String createFileName(java.lang.String baseName, java.lang.String extension, int number)
baseName
- the base name of the new file, or null
if new file should have no base nameextension
- the extension of the new file, or null
if new file should have no extensionnumber
- a non-negative number to be appended to the new file's base name - or to its extension in case that
the former is omitted - or -1 if no number should be appended at allprotected java.lang.String getDefaultBaseName()
protected java.lang.String getDefaultFileExtension()
protected java.lang.String getContentTypeId()
protected java.lang.String getRequiredProjectTypeName()
public void setRequiredProjectTypeName(java.lang.String requiredProjectTypeName)
protected T getMetaModelDescriptor()
metamodel descriptor
of the new file to be created.protected java.lang.String getMetaModelName()
public void setVisible(boolean visible)
setVisible
in interface org.eclipse.jface.dialogs.IDialogPage
setVisible
in class org.eclipse.ui.dialogs.WizardNewFileCreationPage
protected boolean validatePage()
validatePage
in class org.eclipse.ui.dialogs.WizardNewFileCreationPage
protected boolean hasRequiredProjectNature(org.eclipse.core.resources.IProject project)
project
- the project to be checked; must not be null
and must be
accessibletrue
if specified project has the required nature or no nature is required, false
otherwise.protected boolean hasMatchingMetaModelVersion(org.eclipse.core.resources.IProject project)
project
- the project to be checked; must not be null
and must be
accessibletrue
if specified project's metamodel version matches that of the
model file to be created or no metamodel version preference, false
otherwise.protected java.util.Collection<java.lang.String> getValidFileExtensions()
protected java.lang.String getRequiredProjectNatureErrorMessage()
protected java.lang.String getMatchingMetaModelVersionErrorMessage()
protected java.lang.String getFileExtensionErrorMessage(java.util.Collection<java.lang.String> validFileExtensions)
protected java.lang.String convertFileExtensionsToString(java.util.Collection<java.lang.String> fileExtensions)
fileExtensions
- the collection of file extensions to be converted