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