ProjectPropertiesPage.java :  » Scripting » flexharmony » org » flexharmony » eclipse » properties » project » Java Open Source

Java Open Source » Scripting » flexharmony 
flexharmony » org » flexharmony » eclipse » properties » project » ProjectPropertiesPage.java
package org.flexharmony.eclipse.properties.project;

import static org.flexharmony.eclipse.utils.CommonMethods.*;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.dialogs.PropertyPage;
import org.flexharmony.eclipse.properties.PropertiesPanel;

public class ProjectPropertiesPage extends PropertyPage
{
  private PropertiesPanel propertiesPanel;
  
  public ProjectPropertiesPage()
  {}
  
  @Override
  protected Control createContents(Composite parent)
  {
    propertiesPanel = new PropertiesPanel((IProject)getElement(), parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    layout.verticalSpacing = 20;
    propertiesPanel.setLayout(layout);

    return propertiesPanel;
  }
  
  protected void performDefaults() 
  {
    propertiesPanel.restoreDefaults();
    super.performDefaults();
  }

  
  public boolean performOk()
  {
    if (propertiesPanel.valuesChanged())
    {
      try
      {
        propertiesPanel.save();
        projectPropertiesChanged((IProject)getElement());
      }
      catch (CoreException cexc)
      {
        cexc.printStackTrace();
      }
    }
    return super.performOk();
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.