Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2007-04-03 22:12:40 +0000
committerChris Goldthorpe2007-04-03 22:12:40 +0000
commit568809a043a0793c1a194d0023b5b46f6fd5e786 (patch)
tree2a086bc85ba33447a180d26a76e9199e79bdabdc /org.eclipse.ui.intro.universal
parent5c9c188a867a8124764affc73846539f453a77ba (diff)
downloadeclipse.platform.ua-568809a043a0793c1a194d0023b5b46f6fd5e786.tar.gz
eclipse.platform.ua-568809a043a0793c1a194d0023b5b46f6fd5e786.tar.xz
eclipse.platform.ua-568809a043a0793c1a194d0023b5b46f6fd5e786.zip
Bug 177635 - [Intro] Show intro and highlight new content if new intro content is available
Diffstat (limited to 'org.eclipse.ui.intro.universal')
-rw-r--r--org.eclipse.ui.intro.universal/plugin.xml3
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java9
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java14
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java30
-rw-r--r--org.eclipse.ui.intro.universal/themes/shared/html/shared.css7
5 files changed, 49 insertions, 14 deletions
diff --git a/org.eclipse.ui.intro.universal/plugin.xml b/org.eclipse.ui.intro.universal/plugin.xml
index 04031f7e9..2ecd10e51 100644
--- a/org.eclipse.ui.intro.universal/plugin.xml
+++ b/org.eclipse.ui.intro.universal/plugin.xml
@@ -18,7 +18,8 @@
<extension
point="org.eclipse.ui.intro">
<intro
- class="org.eclipse.ui.intro.config.CustomizableIntroPart"
+ class="org.eclipse.ui.intro.config.CustomizableIntroPart"
+ contentDetector="org.eclipse.ui.internal.intro.universal.contentdetect.ContentDetector"
icon="$nl$/icons/welcome16.gif"
id="org.eclipse.ui.intro.universal"/>
</extension>
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
index 611e307c0..c73c53fa8 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
@@ -1,5 +1,5 @@
/***************************************************************************************************
- * Copyright (c) 2006 IBM Corporation and others. All rights reserved. This program and the
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This program and the
* accompanying materials are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
@@ -28,6 +28,8 @@ import org.eclipse.core.runtime.Preferences;
import org.eclipse.help.internal.util.ProductPreferences;
import org.eclipse.help.internal.util.SequenceResolver;
import org.eclipse.jface.action.Action;
+import org.eclipse.ui.internal.intro.impl.model.ExtensionMap;
+import org.eclipse.ui.internal.intro.universal.contentdetect.ContentDetector;
import org.eclipse.ui.internal.intro.universal.util.ImageUtil;
import org.eclipse.ui.internal.intro.universal.util.PreferenceArbiter;
import org.eclipse.ui.intro.IIntroSite;
@@ -135,6 +137,11 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
* given intro data.
*/
private int getImportance(IntroData data, String pageId, String extensionId) {
+ String pluginId = ExtensionMap.getInstance().getPluginId(extensionId);
+ if (ContentDetector.isNew(pluginId)) {
+ ExtensionMap.getInstance().setStartPage(pageId);
+ return ExtensionData.NEW;
+ }
PageData pdata = data.getPage(pageId);
if (pdata != null) {
ExtensionData ed = pdata.findExtension(extensionId, false);
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
index b6cae7f01..6749c32b2 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
@@ -19,9 +19,8 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
-import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.Platform;
@@ -87,8 +86,8 @@ public class ContentDetectHelper {
saveMemento(writeMemento, EXTENSION_NAMES_XML);
}
- public List getContributors() {
- List contributors = new ArrayList();
+ public Set getContributors() {
+ Set contributors = new HashSet();
XMLMemento readMemento = getReadMemento(EXTENSION_NAMES_XML);
if (readMemento == null) {
return contributors;
@@ -156,11 +155,12 @@ public class ContentDetectHelper {
return stateFile;
}
- public String[] findNewContributors(Set contributors, List previousContributors) {
+ public Set findNewContributors(Set contributors, Set previousContributors) {
+ Set result = new HashSet(contributors);
for (Iterator iter = previousContributors.iterator(); iter.hasNext();) {
- contributors.remove(iter.next());
+ result.remove(iter.next());
}
- return (String[])contributors.toArray(new String[contributors.size()]);
+ return result;
}
public void deleteStateFiles() {
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
index 449e507c0..75d504e15 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
@@ -12,7 +12,6 @@
package org.eclipse.ui.internal.intro.universal.contentdetect;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IExtension;
@@ -21,13 +20,19 @@ import org.eclipse.ui.intro.IntroContentDetector;
public class ContentDetector extends IntroContentDetector {
- private String[] newContributors;
+ private static Set newContributors;
+ private static boolean detectorCalled = false;
public ContentDetector() {
}
public boolean isNewContentAvailable() {
try {
+ detectorCalled = true;
+ // If we have previously found new content no need to recompute
+ if (newContributors != null && !newContributors.isEmpty()) {
+ return true;
+ }
IExtension[] extensions = Platform
.getExtensionRegistry()
.getExtensionPoint("org.eclipse.ui.intro.configExtension").getExtensions(); //$NON-NLS-1$
@@ -42,7 +47,7 @@ public class ContentDetector extends IntroContentDetector {
contributors.add(extensions[i].getContributor().getName());
}
if (numIntroExtensions > previous && previous != ContentDetectHelper.NO_STATE) {
- List previousContributors = helper.getContributors();
+ Set previousContributors = helper.getContributors();
newContributors = helper.findNewContributors(contributors, previousContributors);
helper.saveContributors(contributors);
return true;
@@ -55,8 +60,25 @@ public class ContentDetector extends IntroContentDetector {
return false;
}
- public String[] getNewContributors() {
+ /**
+ * @return The set of the ids of config extensions which are new since the last time
+ * intro was opened. May be null if there are no contributors.
+ */
+ public static Set getNewContributors() {
return newContributors;
}
+
+ /**
+ * Test to see if this contribution was newly installed
+ * @param contributionId
+ * @return
+ */
+ public static boolean isNew(String contributionId) {
+ if (!detectorCalled) {
+ detectorCalled = true;
+ new ContentDetector().isNewContentAvailable();
+ }
+ return newContributors != null && newContributors.contains(contributionId);
+ }
}
diff --git a/org.eclipse.ui.intro.universal/themes/shared/html/shared.css b/org.eclipse.ui.intro.universal/themes/shared/html/shared.css
index 2a23ffdb8..d004fa091 100644
--- a/org.eclipse.ui.intro.universal/themes/shared/html/shared.css
+++ b/org.eclipse.ui.intro.universal/themes/shared/html/shared.css
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -91,6 +91,11 @@
background-repeat: repeat-y;
}
+body .importance-new {
+ background-color: url("../graphics/contentpage/ov_high.gif");
+ background-color: #fffacd;
+}
+
body #overview .importance-high {
background-color: #fff7da;
background-image: url("../graphics/contentpage/ov_high.gif");

Back to the top