Skip to content

Commit

Permalink
Added check with Save As XML button to insure VDB is saved in VdbEditor.
Browse files Browse the repository at this point in the history
Changed layout of simple text entry dialog in DataRoleWizard
  • Loading branch information
blafond committed Jul 27, 2017
1 parent 1e6c851 commit 10e748f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,11 @@ String showTextEntryDialog( final String title,
@Override
protected Control createDialogArea( final Composite parent ) {
final Composite dlgPanel = (Composite)super.createDialogArea(parent);
((GridLayout)dlgPanel.getLayout()).numColumns = 2;
dlgPanel.setLayoutData(new GridData(400, 80));
Group group = WidgetFactory.createGroup(dlgPanel, label,
GridData.FILL_BOTH, 1, 1);
final Text nameText = WidgetFactory.createTextField(group, GridData.FILL_HORIZONTAL);
Label theLabel = new Label(dlgPanel, SWT.NONE);
theLabel.setText(label);
final Text nameText = WidgetFactory.createTextField(dlgPanel, GridData.FILL_HORIZONTAL);
if (text != null) {
nameText.setText(text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ public final class VdbEditor extends EditorPart implements IResourceChangeListen

static final String CONFIRM_DIRTY_MODELS_DIALOG_TITLE = i18n("confirmDirtyModelsDialogTitle"); //$NON-NLS-1$
static final String CONFIRM_DIRTY_MODELS_DIALOG_MESSAGE= i18n("confirmDirtyModelsSynchronizeMessage"); //$NON-NLS-1$
static final String VDB_REQUIRES_SAVE_DIALOG_TITLE=i18n("vdbRequiresSaveTitle"); //$NON-NLS-1$
static final String VDB_REQUIRES_SAVE_DIALOG_MESSAGE=i18n("vdbRequiresSaveMessage"); //$NON-NLS-1$
static final String CONFIRM_DIALOG_TITLE = i18n("confirmDialogTitle"); //$NON-NLS-1$
static final String CONFIRM_SYNCHRONIZE_MESSAGE = i18n("confirmSynchronizeMessage"); //$NON-NLS-1$
static final String CONFIRM_SYNCHRONIZE_ALL_MESSAGE = i18n("confirmSynchronizeAllMessage"); //$NON-NLS-1$
Expand Down Expand Up @@ -1793,8 +1795,9 @@ public void widgetSelected( final SelectionEvent event ) {
});
}
{ // execute VDB button
exportDynamicVdbButton = WidgetFactory.createButton(extraButtonPanel, "Export as XML",//i18n("showImportVdbsButton"), //$NON-NLS-1$
exportDynamicVdbButton = WidgetFactory.createButton(extraButtonPanel, i18n("saveAsXml"), //$NON-NLS-1$
GridData.HORIZONTAL_ALIGN_BEGINNING);
exportDynamicVdbButton.setToolTipText(i18n("saveAsXmlTooltip"));
exportDynamicVdbButton.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
Expand All @@ -1803,6 +1806,12 @@ public void widgetSelected( final SelectionEvent event ) {
*/
@Override
public void widgetSelected( final SelectionEvent event ) {
if( isDirty() ) {
MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
VDB_REQUIRES_SAVE_DIALOG_TITLE,
VDB_REQUIRES_SAVE_DIALOG_MESSAGE);
return;
}
SortableSelectionAction action = ModelResourceActionManager.getAction(ModelActionConstants.Resource.GENERATE_VDB_XML);
IResource vdbResource = ((IFileEditorInput)getEditorInput()).getFile();
action.selectionChanged(VdbEditor.this, new StructuredSelection(vdbResource));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ confirmDirtyModelsDialogTitle = Unsaved Models In Workspace
confirmDirtyModelsSynchronizeMessage = You have one or more unsaved models open for editing. \
Synchronizing models before saving may result in your VDB containing out of date models.\n\n\
Do you wish to synchronize anyway?
vdbRequiresSaveTitle=Save VDB Required
vdbRequiresSaveMessage=VDB must be saved before generating XML file
saveAsXml=Save as XML
saveAsXmlTooltip=Generate XML file based version of this VDB and save to workspace or file system
cannotAddDuplicateModelNameTitle=Cannot Add Models to VDB
cannotAddDuplicateModelNameMessage=Adding the selected model(s) to the VDB will result in duplicate model (xmi or xsd) names. \
Check your models (xmi and xsd) in your project and insure that the names are unique.
Expand Down

0 comments on commit 10e748f

Please sign in to comment.