import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
Composite webSettingsComposite = new Composite(composite, SWT.NONE);
webSettingsComposite.setLayout(new GridLayout());
webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Group webSettingsGroup = new Group(webSettingsComposite, SWT.NONE);
- webSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup"));
- webSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- webSettingsGroup.setLayout(new GridLayout());
- localHostSFE =
- new StringFieldEditor(
- IPreferenceConstants.LOCALHOST_PREF,
- PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.localhost"),
- webSettingsGroup);
- localHostSFE.setPreferencePage(this);
- localHostSFE.setPreferenceStore(getPreferenceStore());
- localHostSFE.load();
- documentRootDFE =
- new DirectoryFieldEditor(
- IPreferenceConstants.DOCUMENTROOT_PREF,
- PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.docroot"),
- webSettingsGroup);
- documentRootDFE.setPreferencePage(this);
- documentRootDFE.setPreferenceStore(getPreferenceStore());
- documentRootDFE.load();
-
- new Label(webSettingsGroup, SWT.NONE);
+
showExternalPreviewBFE =
new BooleanFieldEditor(
IPreferenceConstants.SHOW_EXTERNAL_PREVIEW_PREF,
PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.showexternalpreview"),
- webSettingsGroup);
+ webSettingsComposite);
showExternalPreviewBFE.setPreferencePage(this);
showExternalPreviewBFE.setPreferenceStore(getPreferenceStore());
showExternalPreviewBFE.load();
- new Label(webSettingsGroup, SWT.NONE);
+
+ Group webSettingsGroup = new Group(webSettingsComposite, SWT.NONE);
+ webSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup"));
+ GridLayout gridLayout = new GridLayout();
+ // gridLayout.numColumns = 3;
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ webSettingsGroup.setLayoutData(gridData);
+ webSettingsGroup.setLayout(gridLayout);
+
+ // new Label(webSettingsGroup, SWT.NONE);
externalBrowserBFE =
new BooleanFieldEditor(
IPreferenceConstants.USE_EXTERNAL_BROWSER_PREF,
externalBrowserBFE.setPreferenceStore(getPreferenceStore());
externalBrowserBFE.load();
new Label(webSettingsGroup, SWT.NONE);
+ new Label(webSettingsGroup, SWT.NONE);
+ // new Label(webSettingsGroup, SWT.NONE);
externalBrowserSFE =
new StringFieldEditor(
IPreferenceConstants.EXTERNAL_BROWSER_PREF,
externalBrowserSFE.setPreferencePage(this);
externalBrowserSFE.setPreferenceStore(getPreferenceStore());
externalBrowserSFE.load();
+ new Label(webSettingsGroup, SWT.NONE);
+ localHostSFE =
+ new StringFieldEditor(
+ IPreferenceConstants.LOCALHOST_PREF,
+ PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.localhost"),
+ webSettingsGroup);
+ localHostSFE.setPreferencePage(this);
+ localHostSFE.setPreferenceStore(getPreferenceStore());
+ localHostSFE.load();
+ new Label(webSettingsGroup, SWT.NONE);
+
+ documentRootDFE =
+ new DirectoryFieldEditor(
+ IPreferenceConstants.DOCUMENTROOT_PREF,
+ PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.docroot"),
+ webSettingsGroup);
+ documentRootDFE.setPreferencePage(this);
+ documentRootDFE.setPreferenceStore(getPreferenceStore());
+ documentRootDFE.load();
//Create apache
Composite apacheSettingsComposite = new Composite(composite, SWT.NULL);
apacheSettingsComposite.setLayout(new GridLayout());
apacheRestartSFE.setPreferencePage(this);
apacheRestartSFE.setPreferenceStore(getPreferenceStore());
apacheRestartSFE.load();
-
+
phpRunSFE =
new StringFieldEditor(
IPreferenceConstants.PHP_RUN_PREF,
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
*
* This page will be added to the project's property page dialog when the "Properties..." popup menu item is selected
*/
-public class PHPObfuscatorPropertyPage
- extends PropertyPage
- implements IObfuscatorPreferences
-{
- private Text publishText;
-// private Button hasNature,
-// isBuild;
- private Group group;
- private ProjectProperties properties;
-
- private Control buildUI(Composite parent)
- {
- Composite composite = new Composite(parent,SWT.NULL);
- RowLayout rowLayout = new RowLayout();
- rowLayout.type = SWT.VERTICAL;
- rowLayout.wrap = false;
- composite.setLayout(rowLayout);
-// hasNature = new Button(composite,SWT.CHECK);
-// hasNature.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.hasnature"));
-// hasNature.addSelectionListener(new SelectionListener()
-// {
-// public void widgetDefaultSelected(SelectionEvent e)
-// {
-// group.setEnabled(hasNature.getSelection());
-// }
-//
-// public void widgetSelected(SelectionEvent e)
-// {
-// group.setEnabled(hasNature.getSelection());
-// }
-// });
- group = new Group(composite,SWT.NONE);
- group.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.properties"));
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- group.setLayout(gridLayout);
-
- Label label = new Label(group,SWT.RIGHT);
- label.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.publish"));
- publishText = new Text(group,SWT.LEFT);
- publishText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- return composite;
- }
+public class PHPObfuscatorPropertyPage extends PropertyPage implements IObfuscatorPreferences {
+ private Text publishText;
+ // private DirectoryFieldEditor dfe;
+ private Group group;
+ private ProjectProperties properties;
- public void readProperties()
- throws CoreException
- {
- publishText.setText(properties.getPublish());
-// hasNature.setSelection(properties.hasNature());
-// group.setEnabled(hasNature.getSelection());
- group.setEnabled(true);
- }
+ private Control buildUI(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ RowLayout rowLayout = new RowLayout();
+ rowLayout.type = SWT.VERTICAL;
+ rowLayout.wrap = false;
+ composite.setLayout(rowLayout);
+ // hasNature = new Button(composite,SWT.CHECK);
+ // hasNature.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.hasnature"));
+ // hasNature.addSelectionListener(new SelectionListener()
+ // {
+ // public void widgetDefaultSelected(SelectionEvent e)
+ // {
+ // group.setEnabled(hasNature.getSelection());
+ // }
+ //
+ // public void widgetSelected(SelectionEvent e)
+ // {
+ // group.setEnabled(hasNature.getSelection());
+ // }
+ // });
+ group = new Group(composite, SWT.NONE);
+ group.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.properties"));
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ group.setLayout(gridLayout);
- public void writeProperties()
- throws CoreException
- {
- // properties.setNature(hasNature.getSelection());
- properties.setPublish(publishText.getText());
- }
+ Label label = new Label(group, SWT.RIGHT);
+ label.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.publish"));
+ publishText = new Text(group, SWT.LEFT);
+ publishText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- public Control createContents(Composite parent)
- {
- Control control = buildUI(parent);
- try
- {
- IAdaptable adaptable = getElement();
- if(adaptable instanceof IProject)
- {
- properties = new ProjectProperties((IProject)adaptable);
- readProperties();
- }
- }
- catch(CoreException x)
- {
- ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
- makeStatus(x));
- }
- return control;
- }
-
- public boolean performOk()
- {
- try
- {
- writeProperties();
- }
- catch(CoreException x)
- {
- ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
- makeStatus(x));
- }
- return super.performOk();
- }
+// dfe =
+// new DirectoryFieldEditor(
+// "PHPObfuscatorPropertyPage.publish",
+// PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.publish"),
+// group);
- public void performApply()
- {
- try
- {
- writeProperties();
- }
- catch(CoreException x)
- {
- ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
- makeStatus(x));
+ return composite;
+ }
+
+ public void readProperties() throws CoreException {
+ publishText.setText(properties.getPublish());
+ // dfe.loadDefault();
+ // hasNature.setSelection(properties.hasNature());
+ // group.setEnabled(hasNature.getSelection());
+ group.setEnabled(true);
+ }
+
+ public void writeProperties() throws CoreException {
+ // properties.setNature(hasNature.getSelection());
+ properties.setPublish(publishText.getText());
+ // dfe.store();
+ }
+
+ public Control createContents(Composite parent) {
+ Control control = buildUI(parent);
+ try {
+ IAdaptable adaptable = getElement();
+ if (adaptable instanceof IProject) {
+ properties = new ProjectProperties((IProject) adaptable);
+ readProperties();
}
- super.performApply();
- }
+ } catch (CoreException x) {
+ ErrorDialog.openError(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
+ PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
+ makeStatus(x));
+ }
+ return control;
+ }
+
+ public boolean performOk() {
+ try {
+ writeProperties();
+ } catch (CoreException x) {
+ ErrorDialog.openError(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
+ PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
+ makeStatus(x));
+ }
+ return super.performOk();
+ }
+
+ public void performApply() {
+ try {
+ writeProperties();
+ } catch (CoreException x) {
+ ErrorDialog.openError(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
+ PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
+ makeStatus(x));
+ }
+ super.performApply();
+ }
/**
* Create an IStatus object from an exception.
* @param x exception to process
* @return IStatus status object for the above exception
*/
- public static IStatus makeStatus(Exception x)
- {
-// Throwable t = popThrowables(x);
-// if(t instanceof CoreException)
-// return ((CoreException)t).getStatus();
-// else
- return new Status(IStatus.ERROR,
- PHPeclipsePlugin.PLUGIN_ID,
- IStatus.ERROR,
- x.getMessage(),
- x);
+ public static IStatus makeStatus(Exception x) {
+ // Throwable t = popThrowables(x);
+ // if(t instanceof CoreException)
+ // return ((CoreException)t).getStatus();
+ // else
+ return new Status(IStatus.ERROR, PHPeclipsePlugin.PLUGIN_ID, IStatus.ERROR, x.getMessage(), x);
+ }
+ public void performDefaults() {
+ // hasNature.setSelection(true);
+ publishText.setText(DEFAULT_PUBLISH_DIR);
+ super.performDefaults();
}
- public void performDefaults()
- {
- // hasNature.setSelection(true);
- publishText.setText(DEFAULT_PUBLISH_DIR);
- super.performDefaults();
- }
}
\ No newline at end of file