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 @@ -212,12 +212,15 @@ + core.windows.modules.othertabs org.netbeans.core.nativeaccess org.netbeans.modules.visualweb.gravy + org.netbeans.core.windows + org.netbeans.core.windows.actions org.netbeans.core.windows.nativeaccess + org.netbeans.core.windows.view.ui + org.netbeans.core.windows.view.ui.slides org.netbeans.core.windows.view.ui.tabcontrol - org.netbeans.core.windows.resources - org.netbeans.core.windows.actions diff --git a/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSeparateContainer.java b/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSeparateContainer.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSeparateContainer.java +++ b/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSeparateContainer.java @@ -64,6 +64,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.netbeans.core.windows.options.WinSysPrefs; +import org.netbeans.core.windows.view.ui.tabcontrol.TabbedComponentFactory; +import org.openide.util.Lookup; import org.openide.windows.WindowManager; @@ -110,13 +112,7 @@ } protected Tabbed createTabbed() { - Tabbed tabbed; - if(getKind() == Constants.MODE_KIND_EDITOR) { - tabbed = new TabbedAdapter(Constants.MODE_KIND_EDITOR); - } else { - tabbed = new TabbedAdapter(Constants.MODE_KIND_VIEW); - } - return tabbed; + return Lookup.getDefault().lookup(TabbedComponentFactory.class).getTabbedComponent(getKind()); } protected void updateTitle (String title) { diff --git a/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSplitContainer.java b/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSplitContainer.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSplitContainer.java +++ b/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSplitContainer.java @@ -49,11 +49,12 @@ import org.netbeans.core.windows.view.ViewElement; import org.netbeans.core.windows.view.dnd.TopComponentDroppable; import org.netbeans.core.windows.view.dnd.WindowDnDManager; -import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter; import org.openide.windows.TopComponent; import javax.swing.*; import java.awt.*; +import org.netbeans.core.windows.view.ui.tabcontrol.TabbedComponentFactory; +import org.openide.util.Lookup; /** @@ -91,13 +92,7 @@ } protected Tabbed createTabbed() { - Tabbed tabbed; - if(getKind() == Constants.MODE_KIND_EDITOR) { - tabbed = new TabbedAdapter(Constants.MODE_KIND_EDITOR); - } else { - tabbed = new TabbedAdapter(Constants.MODE_KIND_VIEW); - } - return tabbed; + return Lookup.getDefault().lookup(TabbedComponentFactory.class).getTabbedComponent(getKind()); } protected void updateTitle(String title) { diff --git a/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/DefaultTabbedComponentFactory.java b/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/DefaultTabbedComponentFactory.java new file mode 100644 --- /dev/null +++ b/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/DefaultTabbedComponentFactory.java @@ -0,0 +1,57 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2009 Sun Microsystems, Inc. + */ + +/** + * + * @author eppleton + */ + +package org.netbeans.core.windows.view.ui.tabcontrol; + +import org.netbeans.core.windows.view.ui.Tabbed; +import org.openide.util.lookup.ServiceProvider; + + +@ServiceProvider(service=TabbedComponentFactory.class) +public class DefaultTabbedComponentFactory implements TabbedComponentFactory{ + public Tabbed getTabbedComponent(int type) { + return new TabbedAdapter(type); + } + +} diff --git a/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/TabbedComponentFactory.java b/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/TabbedComponentFactory.java new file mode 100644 --- /dev/null +++ b/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/TabbedComponentFactory.java @@ -0,0 +1,52 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2009 Sun Microsystems, Inc. + */ + +package org.netbeans.core.windows.view.ui.tabcontrol; + +import org.netbeans.core.windows.view.ui.Tabbed; + +/** + * + * @author eppleton + */ +public interface TabbedComponentFactory { + + public Tabbed getTabbedComponent(int type); + +}