1 11 package org.eclipse.pde.internal.ui.editor.plugin; 12 13 import org.eclipse.core.resources.IFile; 14 import org.eclipse.osgi.util.NLS; 15 import org.eclipse.pde.internal.ui.PDEUIMessages; 16 import org.eclipse.pde.internal.ui.editor.PDEFormPage; 17 import org.eclipse.swt.layout.GridData; 18 import org.eclipse.swt.layout.GridLayout; 19 import org.eclipse.swt.widgets.Composite; 20 import org.eclipse.ui.IFileEditorInput; 21 import org.eclipse.ui.IPersistableElement; 22 import org.eclipse.ui.forms.IManagedForm; 23 import org.eclipse.ui.forms.editor.FormEditor; 24 import org.eclipse.ui.forms.widgets.ScrolledForm; 25 26 public class MissingResourcePage extends PDEFormPage { 27 28 public MissingResourcePage(FormEditor editor) { 29 super(editor, "missing", PDEUIMessages.MissingResourcePage_missingResource); } 31 32 protected void createFormContent(IManagedForm managedForm) { 33 ScrolledForm form = managedForm.getForm(); 34 Composite comp = managedForm.getToolkit().createComposite(form); 35 comp.setLayout(new GridLayout()); 36 IPersistableElement persistable = getEditorInput().getPersistable(); 37 String text; 38 if (persistable instanceof IFileEditorInput) { 39 IFile file = ((IFileEditorInput)persistable).getFile(); 40 text = NLS.bind(PDEUIMessages.MissingResourcePage_unableToOpenFull, 41 new String [] { 42 PDEUIMessages.MissingResourcePage_unableToOpen, 43 file.getProjectRelativePath().toString(), 44 file.getProject().getName()}); 45 } else 46 text = PDEUIMessages.MissingResourcePage_unableToOpen; 47 form.setText(text); 48 comp.setLayoutData(new GridData(GridData.FILL_BOTH)); 49 } 50 } 51 | Popular Tags |