Shell shell = XMLUIPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell();
if (validateEdit(manager.getModel(), shell)) {
manager.beginNodeAction(this);
EditProcessingInstructionDialog dialog = null;
if (pi != null) {
dialog = new EditProcessingInstructionDialog(shell, pi);
}
else {
dialog = new EditProcessingInstructionDialog(shell, XMLUIMessages._UI_PI_TARGET_VALUE, XMLUIMessages._UI_PI_DATA_VALUE);
}
dialog.create();
dialog.getShell().setText(title);
dialog.setBlockOnOpen(true);
dialog.open();
if (dialog.getReturnCode() == Window.OK) {
if (pi != null) {
childRef = pi;
}
Document document = parent.getNodeType() == Node.DOCUMENT_NODE ? (Document) parent : parent.getOwnerDocument();
Node newNode = document.createProcessingInstruction(dialog.getTarget(), dialog.getData());
parent.insertBefore(newNode, childRef);
if (pi != null) {
parent.removeChild(pi);
}