X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPObfuscatorPropertyPage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPObfuscatorPropertyPage.java index 3397ab3..59d4030 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPObfuscatorPropertyPage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPObfuscatorPropertyPage.java @@ -24,140 +24,124 @@ import org.eclipse.ui.dialogs.PropertyPage; * * 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