Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2009-11-30 16:24:30 -0500
committerChris Goldthorpe2009-11-30 16:24:30 -0500
commit4e84d864163b6e36de5bcaa5708ea42669bf1849 (patch)
tree8123c7b1db55936abea6c758c11d1d3adf93d06b /org.eclipse.help.ui
parentc39c32c8fe53ee81f0571c212ecb4882d6fb7e27 (diff)
downloadeclipse.platform.ua-20091130.tar.gz
eclipse.platform.ua-20091130.tar.xz
eclipse.platform.ua-20091130.zip
Bug 280354 – [Help] Action for doc plugins that reside locally and remotely:v20091130
Diffstat (limited to 'org.eclipse.help.ui')
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java8
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties8
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentBlock.java92
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java84
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICList.java7
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICViewer.java20
6 files changed, 181 insertions, 38 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java
index 434c00e9a..f933a4ec1 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java
@@ -166,9 +166,12 @@ public final class Messages extends NLS {
public static String IndexInstructions;
public static String IndexButton;
- public static String HelpContentPreferencePage_remote;
public static String NoWorkbenchForExecuteCommand_msg;
+ public static String SearchEmbeddedHelpOnly;
+ public static String SearchEmbeddedHelpFirst;
+ public static String SearchEmbeddedHelpLast;
+
// Remote Help Preferences
public static String AddICDialog_10;
@@ -210,7 +213,8 @@ public final class Messages extends NLS {
public static String HelpContentBlock_testConnectionTitle;
public static String HelpContentBlock_rmvTitle;
public static String HelpContentBlock_rmvLabel;
-
+ public static String HelpContentBlock_upTitle;
+ public static String HelpContentBlock_downTitle;
public static String RemoteICLabelProvider_4;
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties
index 595fa3039..706eb0b02 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties
@@ -145,7 +145,9 @@ HelpPreferencePage_helpBrowser = In the help browser
HelpPreferencePage_externalBrowser = In an external browser
HelpPreferencePage_searchLocation = Open help &search
-HelpContentPreferencePage_remote=&Include help content from a remote infocenter
+SearchEmbeddedHelpOnly = Include local help only
+SearchEmbeddedHelpFirst = Include remote help and give local help priority
+SearchEmbeddedHelpLast = Include remote help and give it priority
ScopePreferenceDialog_wtitle = Search Scope - {0}
ScopePreferenceDialog_new=&New...
@@ -183,7 +185,7 @@ IndexButton = Display
NoWorkbenchForExecuteCommand_msg = No workbench available for command execution.
-HelpContentPage_title = Remote Infocenters:
+HelpContentPage_title = Configure Infocenters:
HelpContentBlock_addICTitle = &New
HelpContentBlock_editICTitle = &Edit
HelpContentBlock_removeICTitle = De&lete
@@ -191,6 +193,8 @@ HelpContentBlock_viewICTitle = &View Properties
HelpContentBlock_testConnectionTitle = &Test Connection
HelpContentBlock_rmvTitle=Remove {0} &Infocenter
HelpContentBlock_rmvLabel=Are you sure you want to remove {0}?
+HelpContentBlock_upTitle=&Up
+HelpContentBlock_downTitle=&Down
AddICDialog_2=Add new infocenter
AddICDialog_4=&Name:
AddICDialog_5=&Host:
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentBlock.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentBlock.java
index acf226a82..5dc2f4671 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentBlock.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.help.ui.internal.preferences;
+import java.util.Vector;
+
import org.eclipse.help.internal.base.remote.RemoteIC;
import org.eclipse.help.ui.internal.Messages;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -37,6 +39,8 @@ public class HelpContentBlock {
private Button viewPropertiesButton;
private Button testICConnectionButton;
private Button enableDisableICButton;
+ private Button upButton;
+ private Button downButton;
private IHelpContentBlockContainer container;
private RemoteICViewer remoteICviewer = null;
private int validated = 2;
@@ -57,6 +61,10 @@ public class HelpContentBlock {
testICConnection();
} else if (enableDisableICButton == source) {
enableDisableIC();
+ } else if (upButton == source) {
+ moveICUp();
+ } else if (downButton == source) {
+ moveICDown();
}
}
};
@@ -93,9 +101,16 @@ public class HelpContentBlock {
Messages.HelpContentBlock_3 : Messages.HelpContentBlock_4;
enableDisableICButton = container.createPushButton(parent, enableTitle);
enableDisableICButton.addSelectionListener(selectionListener);
-
+
+ upButton = container.createPushButton(parent,
+ Messages.HelpContentBlock_upTitle);
+ upButton.addSelectionListener(selectionListener);
+
+ downButton = container.createPushButton(parent,
+ Messages.HelpContentBlock_downTitle);
+ downButton.addSelectionListener(selectionListener);
}
-
+
private void viewICProperties() {
// Get selected item
@@ -205,6 +220,9 @@ public class HelpContentBlock {
enableDisableICButton.setText(Messages.HelpContentBlock_3);
enableDisableICButton.setEnabled(true);
+
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
}
}
@@ -257,6 +275,61 @@ public class HelpContentBlock {
}
/**
+ * Raise the search priority of the selected InfoCenter
+ */
+ public void moveICUp() {
+ // Get selected item
+ RemoteIC remoteic = (RemoteIC) ((IStructuredSelection) remoteICviewer
+ .getSelection()).getFirstElement();
+
+ RemoteIC[] rics = remoteICviewer.getRemoteICList().getRemoteICArray();
+
+ for(int i = 0; i < rics.length; i++) {
+ if(rics[i] == remoteic) {
+ // Move the item as long as it's not already at the top of the list
+ if(i > 0) {
+ remoteic = rics[i - 1];
+ rics[i - 1] = rics[i];
+ rics[i] = remoteic;
+ }
+ }
+ }
+ updateRemoteICs(rics);
+ }
+
+ /**
+ * Lower the search priority of the selected InfoCenter
+ */
+ public void moveICDown() {
+ // Get selected item
+ RemoteIC remoteic = (RemoteIC) ((IStructuredSelection) remoteICviewer
+ .getSelection()).getFirstElement();
+
+ RemoteIC[] rics = remoteICviewer.getRemoteICList().getRemoteICArray();
+
+ for(int i = 0; i < rics.length; i++) {
+ if(rics[i] == remoteic) {
+ // Move the item as long as it's not already at the bottom of the list
+ if(i < (rics.length - 1)) {
+ remoteic = rics[i + 1];
+ rics[i + 1] = rics[i];
+ rics[i] = remoteic;
+ }
+ }
+ }
+ updateRemoteICs(rics);
+ }
+
+ /**
+ * @param rics the ordered ICs
+ */
+ public void updateRemoteICs(RemoteIC[] rics) {
+ Vector v = new Vector();
+ for(int i = 0; i < rics.length; i++) { v.add(rics[i]); }
+ getRemoteICviewer().updateRemoteICList(v);
+ }
+
+ /**
* Creates the group which will contain the buttons.
*/
private void createButtonGroup(Composite top) {
@@ -320,6 +393,10 @@ public class HelpContentBlock {
enableDisableICButton.setEnabled(true);
selectedEntry.setEnabled(false);
}
+
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
+
} else {
restoreDefaultButtons();
}
@@ -352,14 +429,16 @@ public class HelpContentBlock {
testICConnectionButton.setEnabled(false);
enableDisableICButton.setEnabled(false);
enableDisableICButton.setText(Messages.HelpContentBlock_4);
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
- //Clear previous table selection
+ // Clear previous table selection
indexSelected = - 1;
}
+
public void disableAllButtons() {
-
addNewICButton.setEnabled(false);
editICButton.setEnabled(false);
removeICButton.setEnabled(false);
@@ -367,7 +446,8 @@ public class HelpContentBlock {
testICConnectionButton.setEnabled(false);
enableDisableICButton.setEnabled(false);
enableDisableICButton.setText(Messages.HelpContentBlock_4);
-
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
}
public RemoteICViewer getRemoteICviewer()
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java
index f4ef90fb2..c17d654ce 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java
@@ -43,14 +43,15 @@ public class HelpContentPreferencePage extends PreferencePage implements
private InfocenterDisplay remoteICPage;
- private Button checkbox;
+ private Button searchLocalHelpOnly;
+ private Button searchLocalHelpFirst;
+ private Button searchLocalHelpLast;
private Label descLabel;
/**
* Creates the preference page
*/
public HelpContentPreferencePage() {
-
}
/*
@@ -71,18 +72,19 @@ public class HelpContentPreferencePage extends PreferencePage implements
IHelpUIConstants.PREF_PAGE_HELP_CONTENT);
initializeDialogUnits(parent);
-
- createCheckbox(parent);
descLabel = new Label(parent, SWT.NONE);
descLabel.setText(Messages.HelpContentPage_title);
Dialog.applyDialogFont(descLabel);
+ createSearchLocalHelpOnly(parent);
+ createSearchLocalHelpFirst(parent);
+ createSearchLocalHelpLast(parent);
+
remoteICPage = new InfocenterDisplay(this);
remoteICPage.createContents(parent);
-
- initializeTableEnablement(checkbox.getSelection());
+ initializeTableEnablement(searchLocalHelpOnly.getSelection());
return parent;
}
@@ -100,7 +102,9 @@ public class HelpContentPreferencePage extends PreferencePage implements
currentBlock.getRemoteICviewer().getRemoteICList().removeAllRemoteICs(currentBlock.getRemoteICList());
currentBlock.getRemoteICviewer().getRemoteICList().loadDefaultPreferences();
currentBlock.restoreDefaultButtons();
- checkbox.setSelection(new DefaultPreferenceFileHandler().isRemoteHelpOn());
+ searchLocalHelpOnly.setSelection(!(new DefaultPreferenceFileHandler().isRemoteHelpOn()));
+ searchLocalHelpFirst.setSelection(new DefaultPreferenceFileHandler().isRemoteHelpPreferred());
+ searchLocalHelpLast.setSelection(new DefaultPreferenceFileHandler().isRemoteHelpPreferred());
changeListener.handleEvent(null);
}
@@ -121,7 +125,8 @@ public class HelpContentPreferencePage extends PreferencePage implements
*
* @see org.eclipse.jface.preference.PreferencePage#performOk()
*/
- prefs.putBoolean(IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, checkbox.getSelection());
+ prefs.putBoolean(IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, !(searchLocalHelpOnly.getSelection()));
+ prefs.putBoolean(IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED, searchLocalHelpLast.getSelection());
currentBlock=remoteICPage.getHelpContentBlock();
currentRemoteICArray=currentBlock.getRemoteICList();
@@ -141,33 +146,62 @@ public class HelpContentPreferencePage extends PreferencePage implements
return super.setButtonLayoutData(button);
}
- private void createCheckbox(Composite parent) {
- checkbox = new Button(parent, SWT.CHECK);
- checkbox.setText(Messages.HelpContentPreferencePage_remote);
- checkbox.addListener(SWT.Selection, changeListener);
+ private void createSearchLocalHelpOnly(Composite parent) {
+ searchLocalHelpOnly = new Button(parent, SWT.RADIO);
+ searchLocalHelpOnly.setText(Messages.SearchEmbeddedHelpOnly);
+ searchLocalHelpOnly.addListener(SWT.Selection, changeListener);
- boolean isOn = Platform.getPreferencesService().getBoolean
+ boolean isRemoteOn = Platform.getPreferencesService().getBoolean
(HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
- checkbox.setSelection(isOn);
- Dialog.applyDialogFont(checkbox);
+
+ searchLocalHelpOnly.setSelection(!isRemoteOn);
+ Dialog.applyDialogFont(searchLocalHelpOnly);
+ }
+
+ private void createSearchLocalHelpFirst(Composite parent) {
+ searchLocalHelpFirst = new Button(parent, SWT.RADIO);
+ searchLocalHelpFirst.setText(Messages.SearchEmbeddedHelpFirst);
+ searchLocalHelpFirst.addListener(SWT.Selection, changeListener);
+
+ boolean isRemoteOn = Platform.getPreferencesService().getBoolean
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
+ boolean isRemotePreferred = Platform.getPreferencesService().getBoolean
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED, false, null);
+
+ searchLocalHelpFirst.setSelection(isRemoteOn && !isRemotePreferred);
+ Dialog.applyDialogFont(searchLocalHelpFirst);
+ }
+
+ private void createSearchLocalHelpLast(Composite parent) {
+ searchLocalHelpLast = new Button(parent, SWT.RADIO);
+ searchLocalHelpLast.setText(Messages.SearchEmbeddedHelpLast);
+ searchLocalHelpLast.addListener(SWT.Selection, changeListener);
+
+ boolean isRemoteOn = Platform.getPreferencesService().getBoolean
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
+ boolean isRemotePreferred = Platform.getPreferencesService().getBoolean
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED, false, null);
+
+ searchLocalHelpLast.setSelection(isRemoteOn && isRemotePreferred);
+ Dialog.applyDialogFont(searchLocalHelpLast);
}
/*
* Initialize the table enablement with the current checkbox selection
*/
- private void initializeTableEnablement(boolean isRemoteHelpEnabled)
+ private void initializeTableEnablement(boolean isRemoteHelpDisabled)
{
HelpContentBlock currentBlock=remoteICPage.getHelpContentBlock();
- if(isRemoteHelpEnabled)
- currentBlock.restoreDefaultButtons();
- else
+ if(isRemoteHelpDisabled)
currentBlock.disableAllButtons();
+ else
+ currentBlock.restoreDefaultButtons();
// Disable/Enable table
- currentBlock.getRemoteICviewer().getTable().setEnabled(isRemoteHelpEnabled);
+ currentBlock.getRemoteICviewer().getTable().setEnabled(!isRemoteHelpDisabled);
}
/*
@@ -179,19 +213,17 @@ public class HelpContentPreferencePage extends PreferencePage implements
HelpContentBlock currentBlock=remoteICPage.getHelpContentBlock();
- boolean isRemoteHelpEnabled=checkbox.getSelection();
+ boolean isRemoteHelpEnabled = !(searchLocalHelpOnly.getSelection());
// Disable/Enable buttons
if(isRemoteHelpEnabled)
currentBlock.restoreDefaultButtons();
else
currentBlock.disableAllButtons();
-
+
// Disable/Enable table
currentBlock.getRemoteICviewer().getTable().setEnabled(isRemoteHelpEnabled);
-
-
-
}
+
};
-
+
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICList.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICList.java
index 3c1d9fe6f..b5d03b1ec 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICList.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICList.java
@@ -113,6 +113,13 @@ public class RemoteICList {
}
/**
+ * @param rics the new set of remote ICs
+ */
+ public void setRemoteICs(Vector rics) {
+ remote_ics = rics;
+ }
+
+ /**
* Return the remote IC at the given index in the table
*/
public RemoteIC getRemoteICAtIndex(int index)
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICViewer.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICViewer.java
index 79203f586..fffa0dc97 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICViewer.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 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
@@ -11,6 +11,7 @@
package org.eclipse.help.ui.internal.preferences;
import java.util.Arrays;
+import java.util.Vector;
import org.eclipse.help.internal.base.remote.RemoteIC;
import org.eclipse.help.ui.internal.Messages;
@@ -174,6 +175,21 @@ public class RemoteICViewer {
}
/**
+ * @param rics the ordered remote InfoCenters
+ */
+ public void updateRemoteICList(Vector rics) {
+ getRemoteICList().setRemoteICs(rics);
+ updateView();
+ }
+
+ /**
+ * Make sure the table viewer shows the latest copy of the ordered InfoCenters
+ */
+ public void updateView() {
+ getTableViewer().refresh(getRemoteICList());
+ }
+
+ /**
* Return the column names in a collection
*
* @return List containing column names
@@ -188,7 +204,7 @@ public class RemoteICViewer {
public ISelection getSelection() {
return tableViewer.getSelection();
}
-
+
/**
* Return the RemoteICList
*/

Back to the top