use of org.eclipse.wst.xml.ui.internal.dialogs.EditDoctypeDialog in project webtools.sourceediting by eclipse.
the class EditDoctypeAction method showEditDoctypeDialog.
protected EditDoctypeDialog showEditDoctypeDialog(Shell shell) {
EditDoctypeDialog dialog = null;
if (doctype != null) {
dialog = new EditDoctypeDialog(shell, doctype);
if (title == null) {
title = XMLUIMessages._UI_LABEL_EDIT_DOCTYPE;
}
} else if (document != null) {
String rootElementName = getRootElementName(document);
// $NON-NLS-1$ //$NON-NLS-2$
dialog = new EditDoctypeDialog(shell, rootElementName, "", rootElementName + ".dtd");
if (title == null) {
title = XMLUIMessages._UI_MENU_ADD_DTD_INFORMATION_TITLE;
}
}
dialog.setComputeSystemId((doctype == null) || (doctype.getSystemId() == null) || (doctype.getSystemId().trim().length() == 0));
// !model.getType().equals(IStructuredModel.HTML));
dialog.setErrorChecking(false);
dialog.create();
dialog.getShell().setText(title);
dialog.setBlockOnOpen(true);
dialog.setResourceLocation(new Path(resourceLocation));
dialog.open();
return dialog;
}
use of org.eclipse.wst.xml.ui.internal.dialogs.EditDoctypeDialog in project webtools.sourceediting by eclipse.
the class EditDoctypeAction method run.
public void run() {
Shell shell = getDisplay().getActiveShell();
if (validateEdit(model, shell)) {
model.beginRecording(this, getUndoDescription());
// Shell shell =
// XMLCommonUIPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell();
EditDoctypeDialog dialog = showEditDoctypeDialog(shell);
if (dialog.getReturnCode() == Window.OK) {
if (doctype != null) {
updateDoctype(dialog, doctype);
} else if (document != null) {
DocumentType doctype = createDoctype(dialog, document);
if (doctype != null) {
insertDoctype(doctype, document);
}
}
}
model.endRecording(this);
}
}
Aggregations