KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > plugin > MissingResourcePage


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.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); //$NON-NLS-1$
30
}
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 JavaDoc text;
38         if (persistable instanceof IFileEditorInput) {
39             IFile file = ((IFileEditorInput)persistable).getFile();
40             text = NLS.bind(PDEUIMessages.MissingResourcePage_unableToOpenFull,
41                     new String JavaDoc[] {
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