Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMazen Faraj2005-11-28 03:38:50 +0000
committerMazen Faraj2005-11-28 03:38:50 +0000
commit94b0333b1532bbc381b6190eaa74cb37af4ece29 (patch)
treedd9abb481ea8c73b90f9f0222b64c7512b2d4cc9 /org.eclipse.help.ui
parent3e91317d66d832f76be14e2f55fd57ba41bc8148 (diff)
downloadeclipse.platform.ua-94b0333b1532bbc381b6190eaa74cb37af4ece29.tar.gz
eclipse.platform.ua-94b0333b1532bbc381b6190eaa74cb37af4ece29.tar.xz
eclipse.platform.ua-94b0333b1532bbc381b6190eaa74cb37af4ece29.zip
*** empty log message ***
Diffstat (limited to 'org.eclipse.help.ui')
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIPlugin.java50
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/xhtml/UIContentFilterProcessor.java75
2 files changed, 102 insertions, 23 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIPlugin.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIPlugin.java
index 971d31a85..0c9f3bf8a 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIPlugin.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIPlugin.java
@@ -1,14 +1,13 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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
+/***************************************************************************************************
+ * Copyright (c) 2000, 2004 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
*
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
+ * Contributors: IBM Corporation - initial API and implementation
+ **************************************************************************************************/
package org.eclipse.help.ui.internal;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -16,7 +15,9 @@ import org.eclipse.help.internal.HelpPlugin;
import org.eclipse.help.internal.base.BaseHelpSystem;
import org.eclipse.help.internal.base.HelpBasePlugin;
import org.eclipse.help.internal.search.federated.IndexerJob;
+import org.eclipse.help.internal.xhtml.XHTMLSupport;
import org.eclipse.help.ui.internal.util.ErrorUtil;
+import org.eclipse.help.ui.internal.xhtml.UIContentFilterProcessor;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
@@ -27,42 +28,41 @@ import org.osgi.framework.BundleContext;
* This class is Help UI plugin.
*/
public class HelpUIPlugin extends AbstractUIPlugin {
+
public final static String PLUGIN_ID = "org.eclipse.help.ui"; //$NON-NLS-1$
// debug options
public static boolean DEBUG = false;
public static boolean DEBUG_INFOPOP = false;
private static HelpUIPlugin plugin;
- //private static BundleContext bundleContext;
+
+ // private static BundleContext bundleContext;
/**
- * Logs an Error message with an exception. Note that the message should
- * already be localized to proper locale. ie: Resources.getString() should
- * already have been called
+ * Logs an Error message with an exception. Note that the message should already be localized to
+ * proper locale. ie: Resources.getString() should already have been called
*/
public static synchronized void logError(String message, Throwable ex) {
logError(message, ex, true, false);
- }
+ }
public static synchronized void logError(String message, Throwable ex, boolean log, boolean openDialog) {
if (message == null)
message = ""; //$NON-NLS-1$
- Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
- message, ex);
+ Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, ex);
HelpPlugin.getDefault().getLog().log(errorStatus);
if (openDialog)
ErrorDialog.openError(null, null, null, errorStatus);
}
+
/**
- * Logs a Warning message with an exception. Note that the message should
- * already be localized to proper local. ie: Resources.getString() should
- * already have been called
+ * Logs a Warning message with an exception. Note that the message should already be localized
+ * to proper local. ie: Resources.getString() should already have been called
*/
public static synchronized void logWarning(String message) {
if (HelpPlugin.DEBUG) {
if (message == null)
message = ""; //$NON-NLS-1$
- Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
- IStatus.OK, message, null);
+ Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null);
HelpPlugin.getDefault().getLog().log(warningStatus);
}
}
@@ -75,6 +75,7 @@ public class HelpUIPlugin extends AbstractUIPlugin {
public static HelpUIPlugin getDefault() {
return plugin;
}
+
/*
* (non-Javadoc)
*
@@ -82,10 +83,11 @@ public class HelpUIPlugin extends AbstractUIPlugin {
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
- //Make sure we cancel indexer if it is currently running
+ // Make sure we cancel indexer if it is currently running
Platform.getJobManager().cancel(IndexerJob.FAMILY);
super.stop(context);
}
+
/*
* (non-Javadoc)
*
@@ -94,7 +96,10 @@ public class HelpUIPlugin extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
- //bundleContext = context;
+ // hook UI filtering
+ XHTMLSupport.setFilterProcessor(new UIContentFilterProcessor());
+
+ // bundleContext = context;
// Setup debugging options
DEBUG = isDebugging();
if (DEBUG) {
@@ -110,8 +115,7 @@ public class HelpUIPlugin extends AbstractUIPlugin {
// use workbench activity support
IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench != null) {
- HelpBasePlugin.setActivitySupport(new HelpActivitySupport(
- workbench));
+ HelpBasePlugin.setActivitySupport(new HelpActivitySupport(workbench));
}
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/xhtml/UIContentFilterProcessor.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/xhtml/UIContentFilterProcessor.java
new file mode 100644
index 000000000..94dfdd76e
--- /dev/null
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/xhtml/UIContentFilterProcessor.java
@@ -0,0 +1,75 @@
+/***************************************************************************************************
+ * Copyright (c) 2004, 2005 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
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+
+package org.eclipse.help.ui.internal.xhtml;
+
+import org.eclipse.help.internal.xhtml.UAContentFilterProcessor;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.activities.IActivityManager;
+import org.eclipse.ui.activities.IWorkbenchActivitySupport;
+import org.eclipse.ui.activities.WorkbenchActivityHelper;
+
+/**
+ * Handles content manipulation. Filters filter content in as opposed to filtering out. ie: if a
+ * filter passes, content is displayed.
+ *
+ */
+public class UIContentFilterProcessor extends UAContentFilterProcessor {
+
+ protected boolean isFilteredIn(String filter, String value) {
+ boolean filtered_in = false;
+ if (filter.equals("category")) {
+ filtered_in = filterByCategory(value);
+ } else if (filter.equals("activity")) {
+ filtered_in = filterByActivity(value);
+ } else
+ filtered_in = super.isFilteredIn(filter, value);
+
+ return filtered_in;
+ }
+
+
+ /**
+ * evaluates Role (aka category) filter.
+ */
+ private static boolean filterByCategory(String categoryId) {
+ IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
+ IActivityManager activityManager = workbenchActivitySupport.getActivityManager();
+ if (!activityManager.getCategory(categoryId).isDefined())
+ // if category is not defined, do not filter.
+ return false;
+
+ boolean categoryIsEnabled = WorkbenchActivityHelper.isEnabled(activityManager, categoryId);
+ if (categoryIsEnabled)
+ // category is enabled, filter content in => content is included.
+ return true;
+ return false;
+ }
+
+
+ /**
+ * evaluates Activity filter.
+ */
+ private static boolean filterByActivity(String activityId) {
+ IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
+ IActivityManager activityManager = workbenchActivitySupport.getActivityManager();
+ if (!activityManager.getActivity(activityId).isDefined())
+ // if activity is not defined, do not filter.
+ return false;
+
+ boolean activityIsEnabled = activityManager.getActivity(activityId).isEnabled();
+ if (activityIsEnabled)
+ // activity is enabled, filter content in => content is included.
+ return true;
+ return false;
+ }
+
+
+
+}

Back to the top