01: /*******************************************************************************
02: * Copyright (c) 2003, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor;
11:
12: import org.eclipse.jface.dialogs.MessageDialog;
13: import org.eclipse.pde.internal.ui.PDEPlugin;
14: import org.eclipse.pde.internal.ui.PDEUIMessages;
15: import org.eclipse.swt.widgets.Display;
16: import org.eclipse.ui.texteditor.DefaultRangeIndicator;
17:
18: public abstract class XMLSourcePage extends PDEProjectionSourcePage {
19:
20: public XMLSourcePage(PDEFormEditor editor, String id, String title) {
21: super (editor, id, title);
22: setRangeIndicator(new DefaultRangeIndicator());
23: }
24:
25: public boolean canLeaveThePage() {
26: boolean cleanModel = getInputContext().isModelCorrect();
27: if (!cleanModel) {
28: Display.getCurrent().beep();
29: String title = getEditor().getSite().getRegisteredName();
30: MessageDialog.openError(
31: PDEPlugin.getActiveWorkbenchShell(), title,
32: PDEUIMessages.SourcePage_errorMessage);
33: }
34: return cleanModel;
35: }
36:
37: protected String[] collectContextMenuPreferencePages() {
38: String[] ids = super .collectContextMenuPreferencePages();
39: String[] more = new String[ids.length + 1];
40: more[0] = "org.eclipse.pde.ui.EditorPreferencePage"; //$NON-NLS-1$
41: System.arraycopy(ids, 0, more, 1, ids.length);
42: return more;
43: }
44:
45: }
|