diff --git a/platform/platform-api/src/com/intellij/openapi/wm/WelcomeScreen.java b/platform/platform-api/src/com/intellij/openapi/wm/WelcomeScreen.java new file mode 100644 index 000000000000..63bb9092b19a --- /dev/null +++ b/platform/platform-api/src/com/intellij/openapi/wm/WelcomeScreen.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.wm; + +import com.intellij.openapi.Disposable; + +import javax.swing.*; + +/** + * @author Konstantin Bulenkov + */ +public interface WelcomeScreen extends Disposable { + JComponent getWelcomePanel(); +} diff --git a/platform/platform-api/src/com/intellij/openapi/wm/WelcomeScreenProvider.java b/platform/platform-api/src/com/intellij/openapi/wm/WelcomeScreenProvider.java new file mode 100644 index 000000000000..62b912d44d43 --- /dev/null +++ b/platform/platform-api/src/com/intellij/openapi/wm/WelcomeScreenProvider.java @@ -0,0 +1,31 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.wm; + +import com.intellij.openapi.extensions.ExtensionPointName; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; + +/** + * @author Konstantin Bulenkov + */ +public interface WelcomeScreenProvider { + ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.welcomeScreen"); + + @Nullable + WelcomeScreen createWelcomeScreen(JRootPane rootPane); +} diff --git a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java index 091162cb8a81..ceeec0f3c3e2 100644 --- a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java +++ b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +32,9 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.IdeFrame; +import com.intellij.openapi.wm.WelcomeScreen; import com.intellij.openapi.wm.impl.IdeRootPane; -import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreen; +import com.intellij.openapi.wm.impl.welcomeScreen.DefaultWelcomeScreen; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBus; import org.jetbrains.annotations.NotNull; @@ -214,9 +215,9 @@ public abstract class RecentProjectsManagerBase implements PersistentStateCompon IdeFrame frame = e.getData(IdeFrame.KEY); if (frame != null) { IdeRootPane rootPane = (IdeRootPane) frame.getComponent(); - WelcomeScreen welcomeScreen = rootPane.getWelcomeScreen(); - if (welcomeScreen != null) { - welcomeScreen.hideRecentProjectsPanel(); + final WelcomeScreen welcomeScreen = rootPane.getWelcomeScreen(); + if (welcomeScreen instanceof DefaultWelcomeScreen) { + ((DefaultWelcomeScreen)welcomeScreen).hideRecentProjectsPanel(); } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeRootPane.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeRootPane.java index 5f8e060e34d3..2f81eb10ecd2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeRootPane.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeRootPane.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.wm.*; import com.intellij.openapi.wm.impl.status.IdeStatusBarImpl; import com.intellij.openapi.wm.impl.status.MemoryUsagePanel; -import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreen; +import com.intellij.openapi.wm.impl.welcomeScreen.DefaultWelcomeScreen; import com.intellij.ui.PopupHandler; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBusConnection; @@ -81,7 +81,7 @@ public class IdeRootPane extends JRootPane implements UISettingsListener { private final UISettings myUISettings; private WelcomeScreen myWelcomeScreen; - private Component myWelcomePane; + private JComponent myWelcomePane; private final boolean myGlassPaneInitialized; private final IdeGlassPaneImpl myGlassPane; @@ -129,7 +129,13 @@ public class IdeRootPane extends JRootPane implements UISettingsListener { } void showWelcomeScreen() { - myWelcomeScreen = new WelcomeScreen(this); + for (WelcomeScreenProvider provider : WelcomeScreenProvider.EP_NAME.getExtensions()) { + myWelcomeScreen = provider.createWelcomeScreen(this); + if (myWelcomeScreen != null) break; + } + if (myWelcomeScreen == null) { + myWelcomeScreen = new DefaultWelcomeScreen(this); + } Disposer.register(myDisposable, myWelcomeScreen); myWelcomePane = myWelcomeScreen.getWelcomePanel(); myContentPane.add(myWelcomePane); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/DefaultWelcomeScreen.java similarity index 99% rename from platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java rename to platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/DefaultWelcomeScreen.java index 70373166053a..c8e816ec880e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/DefaultWelcomeScreen.java @@ -22,7 +22,6 @@ import com.intellij.ide.ReopenProjectAction; import com.intellij.ide.dnd.FileCopyPasteUtil; import com.intellij.ide.highlighter.ProjectFileType; import com.intellij.ide.plugins.*; -import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.ActionButtonLook; import com.intellij.openapi.actionSystem.impl.PresentationFactory; @@ -34,6 +33,7 @@ import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.wm.WelcomeScreen; import com.intellij.openapi.wm.impl.IdeRootPane; import com.intellij.ui.*; import com.intellij.util.containers.ContainerUtil; @@ -57,7 +57,7 @@ import static java.awt.GridBagConstraints.*; /** * @author pti */ -public class WelcomeScreen implements Disposable { +public class DefaultWelcomeScreen implements WelcomeScreen { private static final Insets ACTION_GROUP_CAPTION_INSETS = new Insets(20, 30, 5, 0); private static final Insets PLUGINS_CAPTION_INSETS = new Insets(20, 25, 0, 0); private static final Insets ACTION_ICON_INSETS = new Insets(5, 20, 15, 0); @@ -122,7 +122,7 @@ public class WelcomeScreen implements Disposable { return myWelcomePanel; } - public WelcomeScreen(IdeRootPane rootPane) { + public DefaultWelcomeScreen(IdeRootPane rootPane) { initApplicationSpecificImages(); myWelcomePanel = new JPanel(new GridBagLayout()); diff --git a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml index 78db4f2f25d5..92cbadf77359 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml @@ -98,6 +98,7 @@ +