KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > XMLSourcePage


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.editor;
12
13 import org.eclipse.jface.dialogs.MessageDialog;
14 import org.eclipse.pde.internal.ui.PDEPlugin;
15 import org.eclipse.pde.internal.ui.PDEUIMessages;
16 import org.eclipse.swt.widgets.Display;
17 import org.eclipse.ui.texteditor.DefaultRangeIndicator;
18
19 public abstract class XMLSourcePage extends PDEProjectionSourcePage {
20
21     public XMLSourcePage(PDEFormEditor editor, String JavaDoc id, String JavaDoc title) {
22         super(editor, id, title);
23         setRangeIndicator(new DefaultRangeIndicator());
24     }
25
26     public boolean canLeaveThePage() {
27         boolean cleanModel = getInputContext().isModelCorrect();
28         if (!cleanModel) {
29             Display.getCurrent().beep();
30             String JavaDoc title = getEditor().getSite().getRegisteredName();
31             MessageDialog.openError(
32                     PDEPlugin.getActiveWorkbenchShell(),
33                     title,
34                     PDEUIMessages.SourcePage_errorMessage);
35         }
36         return cleanModel;
37     }
38
39     protected String JavaDoc[] collectContextMenuPreferencePages() {
40         String JavaDoc[] ids= super.collectContextMenuPreferencePages();
41         String JavaDoc[] more= new String JavaDoc[ids.length + 1];
42         more[0]= "org.eclipse.pde.ui.EditorPreferencePage"; //$NON-NLS-1$
43
System.arraycopy(ids, 0, more, 1, ids.length);
44         return more;
45     }
46
47 }
48
Popular Tags