001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * Portions Copyrighted 2007 Sun Microsystems, Inc.
027: */
028: package org.netbeans.modules.php.project.options;
029:
030: import java.beans.PropertyChangeListener;
031: import java.beans.PropertyChangeSupport;
032: import javax.swing.JComponent;
033: import org.netbeans.spi.options.OptionsPanelController;
034: import org.openide.util.HelpCtx;
035: import org.openide.util.Lookup;
036:
037: /**
038: *
039: * @author avk
040: */
041: public class CommandLineOptionsPanelController extends
042: OptionsPanelController {
043:
044: public void update() {
045: myChanged = false;
046: myPanel.load();
047: }
048:
049: public void applyChanges() {
050: myPanel.store();
051: myChanged = false;
052: }
053:
054: public void cancel() {
055: myPanel.cancel();
056: }
057:
058: public boolean isValid() {
059: return myPanel.isValid();
060: }
061:
062: public boolean isChanged() {
063: return myChanged;
064: }
065:
066: public HelpCtx getHelpCtx() {
067: return null; // new HelpCtx("...ID") if you have a help set
068: }
069:
070: public synchronized JComponent getComponent(Lookup masterLookup) {
071: if (myPanel == null) {
072: myPanel = new CommandLineOptionsPanel(this );
073: }
074: return myPanel;
075: }
076:
077: public void addPropertyChangeListener(PropertyChangeListener l) {
078: myPcs.addPropertyChangeListener(l);
079: }
080:
081: public void removePropertyChangeListener(PropertyChangeListener l) {
082: myPcs.removePropertyChangeListener(l);
083: }
084:
085: void changed() {
086: if (!myChanged) {
087: myChanged = true;
088: myPcs.firePropertyChange(
089: OptionsPanelController.PROP_CHANGED, false, true);
090: }
091: myPcs.firePropertyChange(OptionsPanelController.PROP_VALID,
092: null, null);
093: }
094:
095: private final PropertyChangeSupport myPcs = new PropertyChangeSupport(
096: this );
097:
098: CommandLineOptionsPanel myPanel;
099:
100: private boolean myChanged;
101:
102: }
|