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: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.vmd.midp.propertyeditors;
043:
044: import java.lang.ref.WeakReference;
045: import org.netbeans.modules.vmd.api.model.DesignComponent;
046: import org.netbeans.modules.vmd.midp.actions.GoToSourceSupport;
047:
048: /**
049: *
050: * @author Karol Harezlak
051: */
052: class GoToSourceCPE extends javax.swing.JPanel {
053:
054: private WeakReference<DesignComponent> component;
055:
056: /** Creates new form GoToSourceCPE */
057: public GoToSourceCPE(WeakReference<DesignComponent> component) {
058: this .component = component;
059: initComponents();
060: }
061:
062: /** This method is called from within the constructor to
063: * initialize the form.
064: * WARNING: Do NOT modify this code. The content of this method is
065: * always regenerated by the Form Editor.
066: */
067: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
068: private void initComponents() {
069:
070: goToSourceButton = new javax.swing.JButton();
071: noteLabel = new javax.swing.JLabel();
072:
073: setMinimumSize(new java.awt.Dimension(350, 80));
074: setPreferredSize(new java.awt.Dimension(350, 80));
075:
076: org.openide.awt.Mnemonics.setLocalizedText(goToSourceButton,
077: org.openide.util.NbBundle
078: .getMessage(GoToSourceCPE.class,
079: "LBL_GoToSourceButtonText")); // NOI18N
080: goToSourceButton
081: .addActionListener(new java.awt.event.ActionListener() {
082: public void actionPerformed(
083: java.awt.event.ActionEvent evt) {
084: goToSourceButtonActionPerformed(evt);
085: }
086: });
087:
088: noteLabel.setText(org.openide.util.NbBundle.getMessage(
089: GoToSourceCPE.class, "LBL_GoToSourceNote")); // NOI18N
090:
091: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
092: this );
093: this .setLayout(layout);
094: layout
095: .setHorizontalGroup(layout
096: .createParallelGroup(
097: org.jdesktop.layout.GroupLayout.LEADING)
098: .add(
099: layout
100: .createSequentialGroup()
101: .add(16, 16, 16)
102: .add(
103: layout
104: .createParallelGroup(
105: org.jdesktop.layout.GroupLayout.LEADING)
106: .add(noteLabel)
107: .add(
108: goToSourceButton))
109: .addContainerGap(38,
110: Short.MAX_VALUE)));
111: layout
112: .setVerticalGroup(layout
113: .createParallelGroup(
114: org.jdesktop.layout.GroupLayout.LEADING)
115: .add(
116: layout
117: .createSequentialGroup()
118: .add(16, 16, 16)
119: .add(goToSourceButton)
120: .addPreferredGap(
121: org.jdesktop.layout.LayoutStyle.UNRELATED)
122: .add(noteLabel)
123: .addContainerGap(16,
124: Short.MAX_VALUE)));
125: }// </editor-fold>//GEN-END:initComponents
126:
127: private void goToSourceButtonActionPerformed(
128: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goToSourceButtonActionPerformed
129: GoToSourceSupport.goToSourceOfComponent(component.get());
130: }//GEN-LAST:event_goToSourceButtonActionPerformed
131:
132: // Variables declaration - do not modify//GEN-BEGIN:variables
133: private javax.swing.JButton goToSourceButton;
134: private javax.swing.JLabel noteLabel;
135: // End of variables declaration//GEN-END:variables
136:
137: }
|