diff --git a/core.windows/manifest.mf b/core.windows/manifest.mf
--- a/core.windows/manifest.mf
+++ b/core.windows/manifest.mf
@@ -6,5 +6,5 @@
OpenIDE-Module-Recommends: org.netbeans.core.windows.nativeaccess.NativeWindowSystem
AutoUpdate-Show-In-Client: false
AutoUpdate-Essential-Module: true
-OpenIDE-Module-Specification-Version: 2.51
+OpenIDE-Module-Specification-Version: 2.52
diff --git a/core.windows/nbproject/project.xml b/core.windows/nbproject/project.xml
--- a/core.windows/nbproject/project.xml
+++ b/core.windows/nbproject/project.xml
@@ -101,7 +101,7 @@
- 6.2
+ 7.48
diff --git a/openide.awt/src/org/openide/awt/CloseButtonTabbedPane.java b/core.windows/src/org/netbeans/core/windows/view/ui/CloseButtonTabbedPane.java
rename from openide.awt/src/org/openide/awt/CloseButtonTabbedPane.java
rename to core.windows/src/org/netbeans/core/windows/view/ui/CloseButtonTabbedPane.java
--- a/openide.awt/src/org/openide/awt/CloseButtonTabbedPane.java
+++ b/core.windows/src/org/netbeans/core/windows/view/ui/CloseButtonTabbedPane.java
@@ -42,7 +42,7 @@
* made subject to such option by the copyright holder.
*/
-package org.openide.awt;
+package org.netbeans.core.windows.view.ui;
import java.awt.*;
import java.awt.event.ActionEvent;
@@ -56,21 +56,24 @@
import java.util.regex.Pattern;
import javax.swing.*;
import javax.swing.plaf.UIResource;
+import org.netbeans.core.windows.actions.MaximizeWindowAction;
+import org.openide.awt.CloseButtonFactory;
+import org.openide.awt.TabbedPaneFactory;
import org.openide.util.Exceptions;
import org.openide.util.Utilities;
+import org.openide.windows.TopComponent;
/**
* Copy of original CloseButtonTabbedPane from the NetBeans 3.4 winsys. Old code never dies.
+ * (moved from openide.awt module)
*
* @author Tran Duc Trung
* @author S. Aubrecht
- * @since 6.10.0
+ * @since 2.52
*
*/
final class CloseButtonTabbedPane extends JTabbedPane implements PropertyChangeListener {
- static final String PROP_CLOSE = "close";
-
CloseButtonTabbedPane() {
// close tab via middle button
addMouseListener(new MouseAdapter() {
@@ -96,6 +99,21 @@
lastIdx = -1;
}
}
+
+ @Override
+ public void mouseClicked( MouseEvent e ) {
+ if( e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton( e ) ) {
+ //toggle maximize
+ TopComponent tc = ( TopComponent ) SwingUtilities.getAncestorOfClass( TopComponent.class, CloseButtonTabbedPane.this );
+ if( null != tc ) {
+ MaximizeWindowAction mwa = new MaximizeWindowAction(tc);
+ if( mwa.isEnabled() )
+ mwa.actionPerformed(null);
+ }
+ }
+ }
+
+
});
//Bugfix #28263: Disable focus.
setFocusable(false);
@@ -110,22 +128,27 @@
}
private class CBTPPolicy extends FocusTraversalPolicy {
+ @Override
public Component getComponentAfter(Container aContainer, Component aComponent) {
return sel();
}
+ @Override
public Component getComponentBefore(Container aContainer, Component aComponent) {
return sel();
}
+ @Override
public Component getFirstComponent(Container aContainer) {
return sel();
}
+ @Override
public Component getLastComponent(Container aContainer) {
return sel();
}
+ @Override
public Component getDefaultComponent(Container aContainer) {
return sel();
}
@@ -359,7 +382,7 @@
}
private void fireCloseRequest(Component c) {
- firePropertyChange(PROP_CLOSE, null, c);
+ firePropertyChange(TabbedPaneFactory.PROP_CLOSE, null, c);
if (getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) {
int idx = getSelectedIndex();
if (idx > 0) {
@@ -438,6 +461,7 @@
return super.getBackgroundAt(index);
}
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getSource() instanceof Component) {
assert evt.getPropertyName().equals(TabbedPaneFactory.NO_CLOSE_BUTTON);
diff --git a/openide.awt/apichanges.xml b/openide.awt/apichanges.xml
--- a/openide.awt/apichanges.xml
+++ b/openide.awt/apichanges.xml
@@ -50,6 +50,19 @@
AWT API
+
+
+ TabbedPaneFactory can be subclassed.
+
+
+
+
+ It is possible to subclass TabbedPaneFactory to provide custom
+ implementations of close button tabbed pane.
+
+
+
+
Support for Check for Updates feature
diff --git a/openide.awt/manifest.mf b/openide.awt/manifest.mf
--- a/openide.awt/manifest.mf
+++ b/openide.awt/manifest.mf
@@ -2,5 +2,5 @@
OpenIDE-Module: org.openide.awt
OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties
AutoUpdate-Essential-Module: true
-OpenIDE-Module-Specification-Version: 7.47
+OpenIDE-Module-Specification-Version: 7.48
diff --git a/openide.awt/src/org/openide/awt/TabbedPaneFactory.java b/openide.awt/src/org/openide/awt/TabbedPaneFactory.java
--- a/openide.awt/src/org/openide/awt/TabbedPaneFactory.java
+++ b/openide.awt/src/org/openide/awt/TabbedPaneFactory.java
@@ -45,6 +45,7 @@
package org.openide.awt;
import javax.swing.JTabbedPane;
+import org.openide.util.Lookup;
/**
* Factory class for TabbedPanes with closeable tabs.
@@ -58,7 +59,7 @@
* Name of the property that is fired from the closeable tabbed pane
* when the user clicks close button on a tab.
*/
- public static final String PROP_CLOSE = CloseButtonTabbedPane.PROP_CLOSE;
+ public static final String PROP_CLOSE = "close"; //NOI18N
/**
* To hide close button feature on specific tab, put value Boolean.TRUE
@@ -68,12 +69,30 @@
*
* @since 7.8
*/
- public static final String NO_CLOSE_BUTTON = "noCloseButton";
-
- /** Creates a new instance of TabbedPaneFactory */
- private TabbedPaneFactory() {
+ public static final String NO_CLOSE_BUTTON = "noCloseButton"; //NOI18N
+
+ /**
+ * @return TabbedPaneFactory instance from the global Lookup.
+ */
+ public static TabbedPaneFactory getDefault() {
+ TabbedPaneFactory res = Lookup.getDefault().lookup( TabbedPaneFactory.class );
+ if( null == res )
+ return new TabbedPaneFactory();
+
+ return res;
}
-
+
+ /**
+ * The default implementation provides just the vanilla Swing JTabbedPane.
+ * The actual implementation in core.windows provides a special subclass
+ * with a small 'close' button in each tab.
+ * @return A new TabbedPane instance.
+ * @since 7.48
+ */
+ public JTabbedPane createTabbedPane() {
+ return new JTabbedPane();
+ }
+
/**
* Creates a special {@link JTabbedPane} that displays a small 'close' button in each tab.
* When user clicks the close button a {@link java.beans.PropertyChangeEvent} is fired from the
@@ -84,6 +103,6 @@
* @see TabbedPaneFactory#NO_CLOSE_BUTTON
*/
public static JTabbedPane createCloseButtonTabbedPane() {
- return new CloseButtonTabbedPane();
+ return getDefault().createTabbedPane();
}
}