1 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 id, String 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 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 [] collectContextMenuPreferencePages() { 40 String [] ids= super.collectContextMenuPreferencePages(); 41 String [] more= new String [ids.length + 1]; 42 more[0]= "org.eclipse.pde.ui.EditorPreferencePage"; System.arraycopy(ids, 0, more, 1, ids.length); 44 return more; 45 } 46 47 } 48 | Popular Tags |