1 package com.bull.eclipse.jonas; 2 3 7 8 import org.eclipse.core.resources.IProject; 9 import org.eclipse.core.runtime.CoreException; 10 import org.eclipse.jdt.core.IJavaProject; 11 import org.eclipse.jdt.core.JavaCore; 12 import org.eclipse.jdt.internal.ui.util.TabFolderLayout; 13 import org.eclipse.jface.preference.IPreferencePage; 14 import org.eclipse.jface.preference.PreferencePage; 15 import org.eclipse.swt.SWT; 16 import org.eclipse.swt.layout.GridData; 17 import org.eclipse.swt.widgets.Composite; 18 import org.eclipse.swt.widgets.Control; 19 import org.eclipse.swt.widgets.TabFolder; 20 import org.eclipse.swt.widgets.TabItem; 21 import org.eclipse.ui.IWorkbench; 22 import org.eclipse.ui.IWorkbenchPreferencePage; 23 import org.eclipse.ui.dialogs.PropertyPage; 24 25 32 33 public class JonasProjectPropertyPage extends PropertyPage 34 implements IWorkbenchPreferencePage, JonasPluginResources 35 { 36 private static final boolean DO_NOT_USE_WEBAPP_CLASSLOADER = false; 37 38 private TabFolder folder; 39 private JonasProjectGeneralPropertyPage generalPropertyPage; 40 private JonasProjectExtraResourcesPropertyPage extraResourcesPropertyPage; 41 42 45 protected Control createContents(Composite parent) { 46 if (DO_NOT_USE_WEBAPP_CLASSLOADER==false) { 47 folder = new TabFolder(parent, SWT.NONE); 48 49 folder.setLayout(new TabFolderLayout()); 50 folder.setLayoutData(new GridData(GridData.FILL_BOTH)); 51 52 generalPropertyPage = new JonasProjectGeneralPropertyPage(this); 54 TabItem generalTab = new TabItem(folder, SWT.NONE); 56 generalTab.setText(JonasPluginResources.PROPERTIES_PAGE_PROJECT_GENERAL_TAB_LABEL); 57 generalTab.setControl(generalPropertyPage.createContents(folder)); 58 59 extraResourcesPropertyPage = new JonasProjectExtraResourcesPropertyPage(this); 61 TabItem extraClassTab = new TabItem(folder, SWT.NONE); 63 extraClassTab.setText(JonasPluginResources.PROPERTIES_PAGE_PROJECT_EXTRA_TAB_LABEL); 64 extraClassTab.setControl(extraResourcesPropertyPage.getControl(folder)); 65 66 return folder; 67 } else { 68 generalPropertyPage = new JonasProjectGeneralPropertyPage(this); 69 return generalPropertyPage.createContents(parent); 70 } 71 } 72 73 76 public boolean performOk() { 77 if (generalPropertyPage.performOk() == true) 79 if (generalPropertyPage.isJonasProjectChecked()) 81 if (extraResourcesPropertyPage != null) 82 extraResourcesPropertyPage.performOk(); 83 84 return true; 85 } 86 87 90 public void init(IWorkbench workbench) { 91 } 92 93 94 protected IJavaProject getJavaProject() throws CoreException { 95 IProject project = (IProject)(this.getElement().getAdapter(IProject.class)); 96 return (IJavaProject)(project.getNature(JavaCore.NATURE_ID)); 97 } 98 protected JonasProject getJonasProject() throws CoreException { 99 return JonasProject.create(getJavaProject()); 100 } 101 102 } 103 104 | Popular Tags |