Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ui.intro.universal')
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java24
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java16
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java88
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java76
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java12
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java212
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java2
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java16
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java6
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java422
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java220
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java8
12 files changed, 551 insertions, 551 deletions
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
index 87bdcd486..ddc830aa1 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
@@ -407,12 +407,12 @@ public class CustomizationContentsArea {
if (previewImage==null) {
String path = element.getAttribute("previewImage"); //$NON-NLS-1$
if (path!=null) {
- String bid = element.getDeclaringExtension().getContributor().getName();
- Bundle bundle = Platform.getBundle(bid);
- if (bundle!=null) {
- ImageDescriptor desc = ImageUtil.createImageDescriptor(bundle, path);
- previewImage = desc.createImage();
- }
+ String bid = element.getDeclaringExtension().getContributor().getName();
+ Bundle bundle = Platform.getBundle(bid);
+ if (bundle!=null) {
+ ImageDescriptor desc = ImageUtil.createImageDescriptor(bundle, path);
+ previewImage = desc.createImage();
+ }
}
}
return previewImage;
@@ -622,7 +622,7 @@ public class CustomizationContentsArea {
while (stok.hasMoreTokens()) {
String tok = stok.nextToken().trim();
if (!NO_ROOT_PAGES.equals(tok)) {
- introRootPages.add(tok);
+ introRootPages.add(tok);
}
}
}
@@ -650,11 +650,11 @@ public class CustomizationContentsArea {
String pidKey = pid + "_" + key; //$NON-NLS-1$
String value;
if (!fromDefault) {
- prefs = InstanceScope.INSTANCE.getNode(pluginId);
- value = getPreference(key, prefs, pidKey, null);
- if (value != null) {
- return value;
- }
+ prefs = InstanceScope.INSTANCE.getNode(pluginId);
+ value = getPreference(key, prefs, pidKey, null);
+ if (value != null) {
+ return value;
+ }
}
prefs = DefaultScope.INSTANCE.getNode(pluginId);
return getPreference(key, prefs, pidKey, ""); //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java
index a4d3d6a07..9d6937035 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java
@@ -24,7 +24,7 @@ import org.eclipse.ui.internal.intro.universal.util.ImageUtil;
public class CustomizationDialog extends TrayDialog {
- private CustomizationContentsArea contentsArea;
+ private CustomizationContentsArea contentsArea;
private String pageId;
private CustomizationContentsArea getContentsArea() {
@@ -53,22 +53,22 @@ public class CustomizationDialog extends TrayDialog {
@Override
protected void okPressed() {
if (getContentsArea().performOk()) {
- getContentsArea().dispose();
+ getContentsArea().dispose();
}
super.okPressed();
}
@Override
protected void cancelPressed() {
- getContentsArea().dispose();
- super.cancelPressed();
+ getContentsArea().dispose();
+ super.cancelPressed();
}
- @Override
+ @Override
protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
+ super.configureShell(newShell);
newShell.setText(Messages.WelcomeCustomizationPreferencePage_Customize);
- newShell.setImage(ImageUtil.createImage("full/elcl16/configure.png")); //$NON-NLS-1$);
- }
+ newShell.setImage(ImageUtil.createImage("full/elcl16/configure.png")); //$NON-NLS-1$);
+ }
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java
index 0b4649edc..b678bf1df 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java
@@ -16,50 +16,50 @@ package org.eclipse.ui.internal.intro.universal;
public interface IUniversalIntroConstants {
- // all attributes here are by default public static final.
-
- // General consts.
- // ---------------
- String PLUGIN_ID = "org.eclipse.ui.intro.universal"; //$NON-NLS-1$
- String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Empty Standby Content part. This is registered in this plugin,
- // through markup.
- String EMPTY_STANDBY_CONTENT_PART = "org.eclipse.ui.intro.config.emptyStandby"; //$NON-NLS-1$
-
- // Memento constants
- // ------------------
- String MEMENTO_PRESENTATION_TAG = "presentation"; //$NON-NLS-1$
- String MEMENTO_CURRENT_PAGE_ATT = "currentPage"; //$NON-NLS-1$
- String MEMENTO_STANDBY_PART_TAG = "standbyPart"; //$NON-NLS-1$
- String MEMENTO_STANDBY_CONTENT_PART_ID_ATT = "contentPartID"; //$NON-NLS-1$
- String MEMENTO_STANDBY_CONTENT_PART_TAG = "standbyContentPart"; //$NON-NLS-1$
- String MEMENTO_RESTORE_ATT = "restore"; //$NON-NLS-1$
-
- // CustomizableIntroPart consts:
- // -----------------------------
- // key to retrieve if a standby part is needed.
- String SHOW_STANDBY_PART = "showStandbyPart"; //$NON-NLS-1$
-
- // Form implementation consts:
- // ---------------------------
- // key to retrieve the into link model object from imageHyperlink widget.
- // convention: actual string value is class name.
- String INTRO_LINK = "IntroLink"; //$NON-NLS-1$
-
- // key to retrive page sub-title from PageContentForm
- String PAGE_SUBTITLE = "PageSubtitle"; //$NON-NLS-1$
-
-
- // Performance keys
- // -----------------------
- String INTRO = "intro"; //$NON-NLS-1$
- String PERF_VIEW_CREATION_TIME = PLUGIN_ID + "/perf/createView"; //$NON-NLS-1$
- String PERF_SET_STANDBY_STATE = PLUGIN_ID + "/perf/setStandbyState"; //$NON-NLS-1$
- // not exposed in .option. Used because framework is convenient.
- String PERF_UI_ZOOM = PLUGIN_ID + "/perf/uiZoom"; //$NON-NLS-1$
-
- // Universal Welcome
+ // all attributes here are by default public static final.
+
+ // General consts.
+ // ---------------
+ String PLUGIN_ID = "org.eclipse.ui.intro.universal"; //$NON-NLS-1$
+ String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
+
+ // Empty Standby Content part. This is registered in this plugin,
+ // through markup.
+ String EMPTY_STANDBY_CONTENT_PART = "org.eclipse.ui.intro.config.emptyStandby"; //$NON-NLS-1$
+
+ // Memento constants
+ // ------------------
+ String MEMENTO_PRESENTATION_TAG = "presentation"; //$NON-NLS-1$
+ String MEMENTO_CURRENT_PAGE_ATT = "currentPage"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_PART_TAG = "standbyPart"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_CONTENT_PART_ID_ATT = "contentPartID"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_CONTENT_PART_TAG = "standbyContentPart"; //$NON-NLS-1$
+ String MEMENTO_RESTORE_ATT = "restore"; //$NON-NLS-1$
+
+ // CustomizableIntroPart consts:
+ // -----------------------------
+ // key to retrieve if a standby part is needed.
+ String SHOW_STANDBY_PART = "showStandbyPart"; //$NON-NLS-1$
+
+ // Form implementation consts:
+ // ---------------------------
+ // key to retrieve the into link model object from imageHyperlink widget.
+ // convention: actual string value is class name.
+ String INTRO_LINK = "IntroLink"; //$NON-NLS-1$
+
+ // key to retrive page sub-title from PageContentForm
+ String PAGE_SUBTITLE = "PageSubtitle"; //$NON-NLS-1$
+
+
+ // Performance keys
+ // -----------------------
+ String INTRO = "intro"; //$NON-NLS-1$
+ String PERF_VIEW_CREATION_TIME = PLUGIN_ID + "/perf/createView"; //$NON-NLS-1$
+ String PERF_SET_STANDBY_STATE = PLUGIN_ID + "/perf/setStandbyState"; //$NON-NLS-1$
+ // not exposed in .option. Used because framework is convenient.
+ String PERF_UI_ZOOM = PLUGIN_ID + "/perf/uiZoom"; //$NON-NLS-1$
+
+ // Universal Welcome
String LOW = "low"; //$NON-NLS-1$
String MEDIUM = "medium"; //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
index 236b0ce5b..4a79ca4f5 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
@@ -103,44 +103,44 @@ public class IntroData {
if (bundle==null)
return;
String content = BundleUtil.getResolvedResourceLocation("", fileName, //$NON-NLS-1$
- bundle);
- IntroContentParser parser = new IntroContentParser(content);
- Document dom = parser.getDocument();
- // dom can be null if the content file cannot be found
- if (dom==null)
- return;
- Element root = dom.getDocumentElement();
- Element extension = null;
- NodeList children = root.getChildNodes();
- for (int i=0; i<children.getLength(); i++) {
- Node child = children.item(i);
- if (child.getNodeType()==Node.ELEMENT_NODE) {
- Element el = (Element)child;
- if (el.getNodeName().equalsIgnoreCase("extensionContent")) { //$NON-NLS-1$
- extension = el;
- break;
- }
- }
- }
- if (extension==null)
- return;
- String id = extension.getAttribute("id"); //$NON-NLS-1$
- String name = extension.getAttribute("name"); //$NON-NLS-1$
- String path = extension.getAttribute("path"); //$NON-NLS-1$
- if (id==null || path==null)
- return;
- int at = path.lastIndexOf("/@"); //$NON-NLS-1$
- if (at == -1)
- return;
- if (path.charAt(path.length()-1)!='@')
- return;
- String pageId = path.substring(0, at);
- PageData pd = pages.get(pageId);
- if (pd==null) {
- pd = new PageData(pageId);
- pages.put(pageId, pd);
- }
- pd.addImplicitExtension(id, name);
+ bundle);
+ IntroContentParser parser = new IntroContentParser(content);
+ Document dom = parser.getDocument();
+ // dom can be null if the content file cannot be found
+ if (dom==null)
+ return;
+ Element root = dom.getDocumentElement();
+ Element extension = null;
+ NodeList children = root.getChildNodes();
+ for (int i=0; i<children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child.getNodeType()==Node.ELEMENT_NODE) {
+ Element el = (Element)child;
+ if (el.getNodeName().equalsIgnoreCase("extensionContent")) { //$NON-NLS-1$
+ extension = el;
+ break;
+ }
+ }
+ }
+ if (extension==null)
+ return;
+ String id = extension.getAttribute("id"); //$NON-NLS-1$
+ String name = extension.getAttribute("name"); //$NON-NLS-1$
+ String path = extension.getAttribute("path"); //$NON-NLS-1$
+ if (id==null || path==null)
+ return;
+ int at = path.lastIndexOf("/@"); //$NON-NLS-1$
+ if (at == -1)
+ return;
+ if (path.charAt(path.length()-1)!='@')
+ return;
+ String pageId = path.substring(0, at);
+ PageData pd = pages.get(pageId);
+ if (pd==null) {
+ pd = new PageData(pageId);
+ pages.put(pageId, pd);
+ }
+ pd.addImplicitExtension(id, name);
}
private Document parse(String fileNameOrData) {
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java
index 927066f1d..a2bbe6437 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java
@@ -16,14 +16,14 @@ package org.eclipse.ui.internal.intro.universal;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
- private static final String INTRO_RESOURCE_BUNDLE = "org.eclipse.ui.internal.intro.universal.Messages"; //$NON-NLS-1$
+ private static final String INTRO_RESOURCE_BUNDLE = "org.eclipse.ui.internal.intro.universal.Messages"; //$NON-NLS-1$
- static {
- initializeMessages(INTRO_RESOURCE_BUNDLE, Messages.class);
- }
+ static {
+ initializeMessages(INTRO_RESOURCE_BUNDLE, Messages.class);
+ }
- // Misc
- // -------
+ // Misc
+ // -------
public static String SharedIntroConfigurer_overview_name;
public static String SharedIntroConfigurer_overview_alt;
public static String SharedIntroConfigurer_overview_tooltip;
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java
index 4a339d596..aa9b29a8a 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java
@@ -26,118 +26,118 @@ import org.osgi.framework.BundleContext;
public class UniversalIntroPlugin extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.eclipse.ui.intro.universal"; //$NON-NLS-1$
- // The static shared instance.
- private static UniversalIntroPlugin inst;
-
- // used for performance logging. Time when the constructor of
- // CustomizableIntroPart is called.
- private long uiCreationStartTime;
-
- // image registry that can be disposed while the
- // plug-in is still active. This is important for
- // switching themes after the plug-in has been loaded.
- private ImageRegistry volatileImageRegistry;
-
- /**
- * The constructor.
- */
- public UniversalIntroPlugin() {
- super();
- }
-
- /**
- * Returns the shared plugin instance.
- */
- public static UniversalIntroPlugin getDefault() {
- return inst;
- }
-
- /**
- * Returns the Intro Part.
- */
- public static IIntroPart getIntro() {
- IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
- .getIntro();
- return introPart;
- }
-
- /**
- * Returns the Intro Part after forcing an open on it.
- */
- public static IIntroPart showIntro(boolean standby) {
- IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
- .showIntro(PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
- standby);
- return introPart;
- }
-
- /**
- * Returns the standby state of the Intro Part. If the intro is closed,
- * retruns false.
- */
- public static boolean isIntroStandby() {
- return PlatformUI.getWorkbench().getIntroManager().isIntroStandby(
- getIntro());
- }
-
- /**
- * Sets the standby state of the Intro Part. If the intro is closed, retruns
- * false.
- */
- public static void setIntroStandby(boolean standby) {
- PlatformUI.getWorkbench().getIntroManager().setIntroStandby(getIntro(),
- standby);
- }
-
-
- /**
- * Returns the standby state of the Intro Part. If the intro is closed,
- * retruns false.
- */
- public static boolean closeIntro() {
- // Relies on Workbench.
- return PlatformUI.getWorkbench().getIntroManager().closeIntro(
- getIntro());
- }
-
- public ImageRegistry getVolatileImageRegistry() {
- if (volatileImageRegistry==null) {
- volatileImageRegistry = createImageRegistry();
- initializeImageRegistry(volatileImageRegistry);
- }
- return volatileImageRegistry;
- }
-
- public void resetVolatileImageRegistry() {
- if (volatileImageRegistry!=null) {
- volatileImageRegistry.dispose();
- volatileImageRegistry = null;
- }
- }
-
-
- @Override
+ // The static shared instance.
+ private static UniversalIntroPlugin inst;
+
+ // used for performance logging. Time when the constructor of
+ // CustomizableIntroPart is called.
+ private long uiCreationStartTime;
+
+ // image registry that can be disposed while the
+ // plug-in is still active. This is important for
+ // switching themes after the plug-in has been loaded.
+ private ImageRegistry volatileImageRegistry;
+
+ /**
+ * The constructor.
+ */
+ public UniversalIntroPlugin() {
+ super();
+ }
+
+ /**
+ * Returns the shared plugin instance.
+ */
+ public static UniversalIntroPlugin getDefault() {
+ return inst;
+ }
+
+ /**
+ * Returns the Intro Part.
+ */
+ public static IIntroPart getIntro() {
+ IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
+ .getIntro();
+ return introPart;
+ }
+
+ /**
+ * Returns the Intro Part after forcing an open on it.
+ */
+ public static IIntroPart showIntro(boolean standby) {
+ IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
+ .showIntro(PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+ standby);
+ return introPart;
+ }
+
+ /**
+ * Returns the standby state of the Intro Part. If the intro is closed,
+ * retruns false.
+ */
+ public static boolean isIntroStandby() {
+ return PlatformUI.getWorkbench().getIntroManager().isIntroStandby(
+ getIntro());
+ }
+
+ /**
+ * Sets the standby state of the Intro Part. If the intro is closed, retruns
+ * false.
+ */
+ public static void setIntroStandby(boolean standby) {
+ PlatformUI.getWorkbench().getIntroManager().setIntroStandby(getIntro(),
+ standby);
+ }
+
+
+ /**
+ * Returns the standby state of the Intro Part. If the intro is closed,
+ * retruns false.
+ */
+ public static boolean closeIntro() {
+ // Relies on Workbench.
+ return PlatformUI.getWorkbench().getIntroManager().closeIntro(
+ getIntro());
+ }
+
+ public ImageRegistry getVolatileImageRegistry() {
+ if (volatileImageRegistry==null) {
+ volatileImageRegistry = createImageRegistry();
+ initializeImageRegistry(volatileImageRegistry);
+ }
+ return volatileImageRegistry;
+ }
+
+ public void resetVolatileImageRegistry() {
+ if (volatileImageRegistry!=null) {
+ volatileImageRegistry.dispose();
+ volatileImageRegistry = null;
+ }
+ }
+
+
+ @Override
public void start(BundleContext context) throws Exception {
- super.start(context);
- inst = this;
- if (Log.logInfo)
- Log.info("IntroPlugin - calling start on Intro bundle"); //$NON-NLS-1$
+ super.start(context);
+ inst = this;
+ if (Log.logInfo)
+ Log.info("IntroPlugin - calling start on Intro bundle"); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
public void stop(BundleContext context) throws Exception {
- resetVolatileImageRegistry();
- super.stop(context);
- }
+ resetVolatileImageRegistry();
+ super.stop(context);
+ }
- public long gettUICreationStartTime() {
- return uiCreationStartTime;
- }
+ public long gettUICreationStartTime() {
+ return uiCreationStartTime;
+ }
- public void setUICreationStartTime(long uiCreationStartTime) {
- this.uiCreationStartTime = uiCreationStartTime;
- }
+ public void setUICreationStartTime(long uiCreationStartTime) {
+ this.uiCreationStartTime = uiCreationStartTime;
+ }
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java
index ca65ce244..3cd20e844 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java
@@ -26,7 +26,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
public class WelcomeCustomizationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage,
IExecutableExtension {
- private CustomizationContentsArea contentsArea;
+ private CustomizationContentsArea contentsArea;
public WelcomeCustomizationPreferencePage() {
}
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 5c44f968a..2adb2d873 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
@@ -47,16 +47,16 @@ public class ContentDetectHelper {
private File getConfigurationLocation() {
if (configurationDirectory == null) {
- Location location = Platform.getConfigurationLocation();
- if (location != null) {
- URL configURL = location.getURL();
- if (configURL != null && configURL.getProtocol().startsWith("file")) { //$NON-NLS-1$
- configurationDirectory = new File(configURL.getFile(), PLUGIN_ID);
+ Location location = Platform.getConfigurationLocation();
+ if (location != null) {
+ URL configURL = location.getURL();
+ if (configURL != null && configURL.getProtocol().startsWith("file")) { //$NON-NLS-1$
+ configurationDirectory = new File(configURL.getFile(), PLUGIN_ID);
if (configurationDirectory != null && !configurationDirectory.exists()) {
configurationDirectory.mkdirs();
}
- }
- }
+ }
+ }
}
return configurationDirectory;
}
@@ -119,7 +119,7 @@ public class ContentDetectHelper {
memento = null;
// Do nothing, the file will not exist the first time the workbench in used.
} catch (Exception e) {
- // TODO should we log an error?
+ // TODO should we log an error?
memento = null;
} finally {
try {
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 17befbae5..3cbf652bb 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
@@ -71,9 +71,9 @@ public class ContentDetector extends IntroContentDetector {
*/
public static Set<String> getNewContributors() {
if (!detectorCalled) {
- detectorCalled = true;
- new ContentDetector().isNewContentAvailable();
- }
+ detectorCalled = true;
+ new ContentDetector().isNewContentAvailable();
+ }
return newContributors;
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java
index b0f127175..765078805 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java
@@ -30,230 +30,230 @@ import org.osgi.framework.Constants;
*/
public class BundleUtil {
- private static String NL_TAG = "$nl$/"; //$NON-NLS-1$
+ private static String NL_TAG = "$nl$/"; //$NON-NLS-1$
- /**
- * Utility method to validate the state of a bundle. Log invalid bundles to
- * log file.
- */
- public static boolean bundleHasValidState(Bundle bundle) {
- if (bundle == null || bundle.getState() == Bundle.UNINSTALLED
- || bundle.getState() == Bundle.INSTALLED) {
+ /**
+ * Utility method to validate the state of a bundle. Log invalid bundles to
+ * log file.
+ */
+ public static boolean bundleHasValidState(Bundle bundle) {
+ if (bundle == null || bundle.getState() == Bundle.UNINSTALLED
+ || bundle.getState() == Bundle.INSTALLED) {
- if (bundle == null)
- Log.error("Universal Welcome tried accessing a NULL bundle.", null); //$NON-NLS-1$
- else {
+ if (bundle == null)
+ Log.error("Universal Welcome tried accessing a NULL bundle.", null); //$NON-NLS-1$
+ else {
String msg = StringUtil.concat("Universal Welcome tried accessing Bundle: ", getBundleHeader( //$NON-NLS-1$
bundle, Constants.BUNDLE_NAME), " vendor: ", //$NON-NLS-1$
getBundleHeader(bundle, Constants.BUNDLE_VENDOR), " bundle state: ", //$NON-NLS-1$
String.valueOf(bundle.getState()));
Log.error(msg, null);
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Retrieves the given key from the bundle header.
- *
- * @param bundle
- * @param key
- * @return
- */
- public static String getBundleHeader(Bundle bundle, String key) {
- return bundle.getHeaders().get(key);
- }
-
-
- public static Bundle getBundleFromConfigurationElement(
- IConfigurationElement cfg) {
- return Platform.getBundle(cfg.getNamespaceIdentifier());
- }
-
-
- /**
- * Get the resourcelocation, but do not force an $nl$ on it.
- *
- * @param resource
- * @param element
- * @return
- */
- public static String getResourceLocation(String resource,
- IConfigurationElement element) {
- Bundle bundle = getBundleFromConfigurationElement(element);
- return getResolvedResourceLocation(resource, bundle, false);
- }
-
-
- /**
- * Returns the fully qualified location of the passed resource string from
- * the passed plugin id. If the file could not be loaded from the plugin,
- * the resource is returned as is.
- *
- * @param resource
- * @return
- */
- public static String getResolvedResourceLocation(String resource,
- String pluginId) {
- Bundle bundle = Platform.getBundle(pluginId);
- return getResolvedResourceLocation(resource, bundle, true);
- }
-
-
- /**
- * Shorthand util method.
- *
- * @param resource
- * @return
- */
- public static String getResolvedResourceLocation(String resource,
- Bundle bundle) {
- return getResolvedResourceLocation(resource, bundle, true);
- }
-
-
- public static String getResolvedResourceLocation(String base,
- String resource, Bundle bundle) {
- // quick exits.
- if (resource == null)
- return null;
-
- String fullResource = new Path(base).append(resource).toString();
- String resolvedResource = getResolvedResourceLocation(fullResource,
- bundle, true);
-
- if (resolvedResource.equals(fullResource))
- // return resource as is when the resource does not exist.
- return resource;
- return resolvedResource;
- }
-
-
- public static String getResolvedResourceLocation(String resource,
- Bundle bundle, boolean forceNLResolve) {
- // quick exits.
- if (resource == null)
- return null;
-
- if (bundle == null || !bundleHasValidState(bundle))
- return resource;
-
- URL localLocation = null;
- try {
- // we need to resolve this URL.
- String copyResource = resource;
- if (forceNLResolve && !copyResource.startsWith(NL_TAG)) {
- if (copyResource.startsWith("/") //$NON-NLS-1$
- || copyResource.startsWith("\\")) //$NON-NLS-1$
- copyResource = resource.substring(1);
- copyResource = NL_TAG + copyResource;
- }
- IPath resourcePath = new Path(copyResource);
- localLocation = FileLocator.find(bundle, resourcePath, null);
- if (localLocation == null) {
- // localLocation can be null if the passed resource could not
- // be found relative to the plugin. log fact, return resource,
- // as is.
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Retrieves the given key from the bundle header.
+ *
+ * @param bundle
+ * @param key
+ * @return
+ */
+ public static String getBundleHeader(Bundle bundle, String key) {
+ return bundle.getHeaders().get(key);
+ }
+
+
+ public static Bundle getBundleFromConfigurationElement(
+ IConfigurationElement cfg) {
+ return Platform.getBundle(cfg.getNamespaceIdentifier());
+ }
+
+
+ /**
+ * Get the resourcelocation, but do not force an $nl$ on it.
+ *
+ * @param resource
+ * @param element
+ * @return
+ */
+ public static String getResourceLocation(String resource,
+ IConfigurationElement element) {
+ Bundle bundle = getBundleFromConfigurationElement(element);
+ return getResolvedResourceLocation(resource, bundle, false);
+ }
+
+
+ /**
+ * Returns the fully qualified location of the passed resource string from
+ * the passed plugin id. If the file could not be loaded from the plugin,
+ * the resource is returned as is.
+ *
+ * @param resource
+ * @return
+ */
+ public static String getResolvedResourceLocation(String resource,
+ String pluginId) {
+ Bundle bundle = Platform.getBundle(pluginId);
+ return getResolvedResourceLocation(resource, bundle, true);
+ }
+
+
+ /**
+ * Shorthand util method.
+ *
+ * @param resource
+ * @return
+ */
+ public static String getResolvedResourceLocation(String resource,
+ Bundle bundle) {
+ return getResolvedResourceLocation(resource, bundle, true);
+ }
+
+
+ public static String getResolvedResourceLocation(String base,
+ String resource, Bundle bundle) {
+ // quick exits.
+ if (resource == null)
+ return null;
+
+ String fullResource = new Path(base).append(resource).toString();
+ String resolvedResource = getResolvedResourceLocation(fullResource,
+ bundle, true);
+
+ if (resolvedResource.equals(fullResource))
+ // return resource as is when the resource does not exist.
+ return resource;
+ return resolvedResource;
+ }
+
+
+ public static String getResolvedResourceLocation(String resource,
+ Bundle bundle, boolean forceNLResolve) {
+ // quick exits.
+ if (resource == null)
+ return null;
+
+ if (bundle == null || !bundleHasValidState(bundle))
+ return resource;
+
+ URL localLocation = null;
+ try {
+ // we need to resolve this URL.
+ String copyResource = resource;
+ if (forceNLResolve && !copyResource.startsWith(NL_TAG)) {
+ if (copyResource.startsWith("/") //$NON-NLS-1$
+ || copyResource.startsWith("\\")) //$NON-NLS-1$
+ copyResource = resource.substring(1);
+ copyResource = NL_TAG + copyResource;
+ }
+ IPath resourcePath = new Path(copyResource);
+ localLocation = FileLocator.find(bundle, resourcePath, null);
+ if (localLocation == null) {
+ // localLocation can be null if the passed resource could not
+ // be found relative to the plugin. log fact, return resource,
+ // as is.
String msg = StringUtil.concat("Could not find resource: ", //$NON-NLS-1$
resource, " in ", getBundleHeader( //$NON-NLS-1$
bundle, Constants.BUNDLE_NAME));
- Log.warning(msg);
- return resource;
- }
- /*
- localLocation = FileLocator.toFileURL(localLocation);
- return localLocation.toExternalForm();
- */
- return toExternalForm(localLocation);
- } catch (Exception e) {
+ Log.warning(msg);
+ return resource;
+ }
+ /*
+ localLocation = FileLocator.toFileURL(localLocation);
+ return localLocation.toExternalForm();
+ */
+ return toExternalForm(localLocation);
+ } catch (Exception e) {
String msg = StringUtil.concat("Failed to load resource: ", //$NON-NLS-1$
resource, " from ", getBundleHeader(bundle, //$NON-NLS-1$
Constants.BUNDLE_NAME));
- Log.error(msg, e);
- return resource;
- }
- }
-
- private static String toExternalForm(URL localURL) {
- try {
- localURL = FileLocator.toFileURL(localURL);
- String result = localURL.toExternalForm();
- if (result.startsWith("file:/")) { //$NON-NLS-1$
- if (result.startsWith("file:///")==false) { //$NON-NLS-1$
- result = "file:///"+result.substring(6); //$NON-NLS-1$
- }
- }
- return result;
- }
- catch (IOException e) {
- String msg = "Failed to resolve URL: " //$NON-NLS-1$
- + localURL.toString();
- Log.error(msg, e);
- return localURL.toString();
- }
- }
-
-
-
-
- /** *** used by Intro parser ***** */
- /*
- * Util method to return an URL to a plugin relative resource.
- */
- public static URL getResourceAsURL(String resource, String pluginId) {
- Bundle bundle = Platform.getBundle(pluginId);
- URL localLocation = FileLocator.find(bundle, new Path(
- resource), null);
- return localLocation;
- }
-
-
-
-
- /** ********************* Used by HTML generator ****************** */
- /**
- * Get the absolute path of the given bundle, in the form
- * file:/path_to_plugin
- *
- * @param bundle
- * @return
- */
- public static String getResolvedBundleLocation(Bundle bundle) {
- try {
- URL bundleLocation = bundle.getEntry(""); //$NON-NLS-1$
- if (bundleLocation == null)
- return null;
- /*
- bundleLocation = FileLocator.toFileURL(bundleLocation);
- return bundleLocation.toExternalForm();
- */
- return toExternalForm(bundleLocation);
- } catch (IllegalStateException e) {
- Log.error("Failed to access bundle: " //$NON-NLS-1$
- + bundle.getSymbolicName(), e);
- return null;
- } /* catch (IOException e) {
- Log.error("Failed to resolve URL path for bundle: " //$NON-NLS-1$
- + bundle.getSymbolicName(), e);
- return null;
- } */
- }
-
- /**
- * Get the absolute path of the bundle with id <code>bundleId</code>. If
- * no such bundle is found, return null.
- *
- * @param bundleId
- * @return
- */
- public static String getResolvedBundleLocation(String bundleId) {
- Bundle bundle = Platform.getBundle(bundleId);
- if (bundle == null)
- return null;
- return getResolvedBundleLocation(bundle);
- }
+ Log.error(msg, e);
+ return resource;
+ }
+ }
+
+ private static String toExternalForm(URL localURL) {
+ try {
+ localURL = FileLocator.toFileURL(localURL);
+ String result = localURL.toExternalForm();
+ if (result.startsWith("file:/")) { //$NON-NLS-1$
+ if (result.startsWith("file:///")==false) { //$NON-NLS-1$
+ result = "file:///"+result.substring(6); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+ catch (IOException e) {
+ String msg = "Failed to resolve URL: " //$NON-NLS-1$
+ + localURL.toString();
+ Log.error(msg, e);
+ return localURL.toString();
+ }
+ }
+
+
+
+
+ /** *** used by Intro parser ***** */
+ /*
+ * Util method to return an URL to a plugin relative resource.
+ */
+ public static URL getResourceAsURL(String resource, String pluginId) {
+ Bundle bundle = Platform.getBundle(pluginId);
+ URL localLocation = FileLocator.find(bundle, new Path(
+ resource), null);
+ return localLocation;
+ }
+
+
+
+
+ /** ********************* Used by HTML generator ****************** */
+ /**
+ * Get the absolute path of the given bundle, in the form
+ * file:/path_to_plugin
+ *
+ * @param bundle
+ * @return
+ */
+ public static String getResolvedBundleLocation(Bundle bundle) {
+ try {
+ URL bundleLocation = bundle.getEntry(""); //$NON-NLS-1$
+ if (bundleLocation == null)
+ return null;
+ /*
+ bundleLocation = FileLocator.toFileURL(bundleLocation);
+ return bundleLocation.toExternalForm();
+ */
+ return toExternalForm(bundleLocation);
+ } catch (IllegalStateException e) {
+ Log.error("Failed to access bundle: " //$NON-NLS-1$
+ + bundle.getSymbolicName(), e);
+ return null;
+ } /* catch (IOException e) {
+ Log.error("Failed to resolve URL path for bundle: " //$NON-NLS-1$
+ + bundle.getSymbolicName(), e);
+ return null;
+ } */
+ }
+
+ /**
+ * Get the absolute path of the bundle with id <code>bundleId</code>. If
+ * no such bundle is found, return null.
+ *
+ * @param bundleId
+ * @return
+ */
+ public static String getResolvedBundleLocation(String bundleId) {
+ Bundle bundle = Platform.getBundle(bundleId);
+ if (bundle == null)
+ return null;
+ return getResolvedBundleLocation(bundle);
+ }
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
index ff379fc81..1a0fc6f71 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
@@ -32,114 +32,114 @@ import org.eclipse.ui.internal.intro.universal.UniversalIntroPlugin;
*/
public class Log implements IUniversalIntroConstants {
- /**
- * This MUST be set to <b>false </b> in production. <br>
- * Used to compile out developement debug messages. <br>
- * Compiler compiles out code warpped wit this flag as an optimization.
- */
- public static final boolean DEBUG = false;
-
-
- // Use these flags to filter out code that may be a performance hit.
- // Flag that controls logging of warning message
- public static boolean logWarning = false;
- // Flag that controls logging of information messages
- public static boolean logInfo = false;
- // Flag that controls logging of performance messages
- public static boolean logPerformance = false;
-
- private final static ILog pluginLog = UniversalIntroPlugin.getDefault().getLog();
-
- static {
- // init debug options based on settings defined in ".options" file. If
- // the plugin is not in debug mode, no point setting debug options.
- if (UniversalIntroPlugin.getDefault().isDebugging()) {
- logWarning = true;
- logInfo = getDebugOption("/trace/logInfo"); //$NON-NLS-1$
- logPerformance = getDebugOption("/trace/logPerformance"); //$NON-NLS-1$
- }
-
- }
-
- private static boolean getDebugOption(String option) {
- return "true".equalsIgnoreCase(//$NON-NLS-1$
- Platform.getDebugOption(PLUGIN_ID + option));
- }
-
- /**
- * Log an Error message with an exception. Note that the message should
- * already be localized to proper local. Errors are always logged.
- */
- public static synchronized void error(String message, Throwable ex) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
- message, ex);
- pluginLog.log(errorStatus);
- }
-
- /**
- * Log an Information message. Note that the message should already be
- * localized to proper local. Info messages are only logged when the
- * /trace/logInfo debug option is true.
- */
- public static synchronized void info(String message) {
- if (!logInfo)
- // logging of info messages is not enabled.
- return;
-
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
- }
-
- /**
- * Log an Information message. Note that the message should already be
- * localized to proper local. These messages are always logged. They are not
- * controlled by any debug flags. Logging of these messages can be
- * controlled by the public flags in this class.
- */
- public static synchronized void forcedInfo(String message) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
- }
-
-
- /**
- * Log a Warning message. Note that the message should already be localized
- * to proper local. Warning messages are only logged when the plugin is in
- * debug mode.
- */
- public static synchronized void warning(String message) {
- if (!logWarning)
- // no warning messages (ie: plugin is not in debug mode). Default is
- // to not log warning messages.
- return;
-
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
- IStatus.OK, message, null);
- pluginLog.log(warningStatus);
- }
-
- /**
- * Log a development debug message. Debug messages are compiled out.
- */
- public static synchronized void debugMessage(String className,
- String message) {
- if (DEBUG) {
- MultiStatus debugStatus = new MultiStatus(PLUGIN_ID, IStatus.OK,
- className, null);
- Status infoStatus = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK,
- message, null);
- debugStatus.add(infoStatus);
- pluginLog.log(debugStatus);
- }
- }
+ /**
+ * This MUST be set to <b>false </b> in production. <br>
+ * Used to compile out developement debug messages. <br>
+ * Compiler compiles out code warpped wit this flag as an optimization.
+ */
+ public static final boolean DEBUG = false;
+
+
+ // Use these flags to filter out code that may be a performance hit.
+ // Flag that controls logging of warning message
+ public static boolean logWarning = false;
+ // Flag that controls logging of information messages
+ public static boolean logInfo = false;
+ // Flag that controls logging of performance messages
+ public static boolean logPerformance = false;
+
+ private final static ILog pluginLog = UniversalIntroPlugin.getDefault().getLog();
+
+ static {
+ // init debug options based on settings defined in ".options" file. If
+ // the plugin is not in debug mode, no point setting debug options.
+ if (UniversalIntroPlugin.getDefault().isDebugging()) {
+ logWarning = true;
+ logInfo = getDebugOption("/trace/logInfo"); //$NON-NLS-1$
+ logPerformance = getDebugOption("/trace/logPerformance"); //$NON-NLS-1$
+ }
+
+ }
+
+ private static boolean getDebugOption(String option) {
+ return "true".equalsIgnoreCase(//$NON-NLS-1$
+ Platform.getDebugOption(PLUGIN_ID + option));
+ }
+
+ /**
+ * Log an Error message with an exception. Note that the message should
+ * already be localized to proper local. Errors are always logged.
+ */
+ public static synchronized void error(String message, Throwable ex) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
+ message, ex);
+ pluginLog.log(errorStatus);
+ }
+
+ /**
+ * Log an Information message. Note that the message should already be
+ * localized to proper local. Info messages are only logged when the
+ * /trace/logInfo debug option is true.
+ */
+ public static synchronized void info(String message) {
+ if (!logInfo)
+ // logging of info messages is not enabled.
+ return;
+
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
+ message, null);
+ pluginLog.log(infoStatus);
+ }
+
+ /**
+ * Log an Information message. Note that the message should already be
+ * localized to proper local. These messages are always logged. They are not
+ * controlled by any debug flags. Logging of these messages can be
+ * controlled by the public flags in this class.
+ */
+ public static synchronized void forcedInfo(String message) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
+ message, null);
+ pluginLog.log(infoStatus);
+ }
+
+
+ /**
+ * Log a Warning message. Note that the message should already be localized
+ * to proper local. Warning messages are only logged when the plugin is in
+ * debug mode.
+ */
+ public static synchronized void warning(String message) {
+ if (!logWarning)
+ // no warning messages (ie: plugin is not in debug mode). Default is
+ // to not log warning messages.
+ return;
+
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
+ IStatus.OK, message, null);
+ pluginLog.log(warningStatus);
+ }
+
+ /**
+ * Log a development debug message. Debug messages are compiled out.
+ */
+ public static synchronized void debugMessage(String className,
+ String message) {
+ if (DEBUG) {
+ MultiStatus debugStatus = new MultiStatus(PLUGIN_ID, IStatus.OK,
+ className, null);
+ Status infoStatus = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK,
+ message, null);
+ debugStatus.add(infoStatus);
+ pluginLog.log(debugStatus);
+ }
+ }
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java
index 2fe35a2b0..c1a8ee53e 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java
@@ -16,10 +16,10 @@ package org.eclipse.ui.internal.intro.universal.util;
public class StringUtil {
public static String concat(String... strings) {
- StringBuilder buffer = new StringBuilder();
- for (String string : strings) {
+ StringBuilder buffer = new StringBuilder();
+ for (String string : strings) {
buffer.append(string);
}
- return buffer.toString();
- }
+ return buffer.toString();
+ }
}

Back to the top