summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcaustin2011-10-18 15:11:18 (EDT)
committercaustin2011-10-21 13:06:39 (EDT)
commita10ed458809104767ca8a554a7d75f6b23158c71 (patch)
treec343208592537306b16cf5fcf5f1a612d608609c
parentb775d76514d15bc83a014ed8c7009e96a09c5dec (diff)
downloadeclipse.platform.ua-a10ed458809104767ca8a554a7d75f6b23158c71.zip
eclipse.platform.ua-a10ed458809104767ca8a554a7d75f6b23158c71.tar.gz
eclipse.platform.ua-a10ed458809104767ca8a554a7d75f6b23158c71.tar.bz2
Bug 353134 - Update the Preferences -> Help -> Content UI to a simpler,
cleaner look
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java71
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IC.java163
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java279
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java235
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICPreferences.java212
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java287
6 files changed, 1216 insertions, 31 deletions
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 e0546b0..dcca530 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.help.ui.internal.preferences;
+import java.util.List;
+
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -25,6 +27,7 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -40,6 +43,9 @@ import org.eclipse.ui.PlatformUI;
*/
public class HelpContentPreferencePage extends PreferencePage implements
IWorkbenchPreferencePage {
+
+ private ICTable table;
+ private ICButtons buttons;
private InfocenterDisplay remoteICPage;
@@ -62,6 +68,11 @@ public class HelpContentPreferencePage extends PreferencePage implements
public void init(IWorkbench workbench) {
}
+ public ICTable getTable()
+ {
+ return table;
+ }
+
/*
* (non-Javadoc)
*
@@ -81,10 +92,10 @@ public class HelpContentPreferencePage extends PreferencePage implements
createSearchLocalHelpFirst(parent);
createSearchLocalHelpLast(parent);
- remoteICPage = new InfocenterDisplay(this);
+/* remoteICPage = new InfocenterDisplay(this);
remoteICPage.createContents(parent);
-
- initializeTableEnablement(searchLocalHelpOnly.getSelection());
+*/
+ initializeTableEnablement(parent,searchLocalHelpOnly.getSelection());
return parent;
}
@@ -97,11 +108,15 @@ public class HelpContentPreferencePage extends PreferencePage implements
protected void performDefaults() {
super.performDefaults();
+ List ics = ICPreferences.getDefaultICs();
+ table.setICs(ics);
+
// Restore Defaults functionality here
- HelpContentBlock currentBlock=remoteICPage.getHelpContentBlock();
+/* HelpContentBlock currentBlock=remoteICPage.getHelpContentBlock();
currentBlock.getRemoteICviewer().getRemoteICList().removeAllRemoteICs(currentBlock.getRemoteICList());
currentBlock.getRemoteICviewer().getRemoteICList().loadDefaultPreferences();
currentBlock.restoreDefaultButtons();
+*/
boolean remoteHelpOn = new DefaultPreferenceFileHandler().isRemoteHelpOn();
boolean remoteHelpPreferred = new DefaultPreferenceFileHandler().isRemoteHelpPreferred();
searchLocalHelpOnly.setSelection(!remoteHelpOn);
@@ -117,9 +132,6 @@ public class HelpContentPreferencePage extends PreferencePage implements
*/
public boolean performOk() {
- HelpContentBlock currentBlock;
- RemoteIC[] currentRemoteICArray;
-
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID);
/*
* (non-Javadoc)
@@ -129,13 +141,12 @@ public class HelpContentPreferencePage extends PreferencePage implements
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();
- PreferenceFileHandler.commitRemoteICs(currentRemoteICArray);
-
+
+ List ics = table.getICs();
+ ICPreferences.setICs(ics);
+
RemoteHelp.notifyPreferenceChange();
return super.performOk();
-
}
/*
@@ -191,18 +202,22 @@ public class HelpContentPreferencePage extends PreferencePage implements
* Initialize the table enablement with the current checkbox selection
*/
- private void initializeTableEnablement(boolean isRemoteHelpDisabled)
- {
-
- HelpContentBlock currentBlock=remoteICPage.getHelpContentBlock();
+ private void initializeTableEnablement(Composite parent, boolean isRemoteHelpDisabled)
+ {
+ Composite top = new Composite(parent, SWT.NONE);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 2;
+ layout.marginWidth = 2;
+ top.setLayout(layout);
+
+ top.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ table = new ICTable(top);
+ buttons = new ICButtons(top,this);
- if(isRemoteHelpDisabled)
- currentBlock.disableAllButtons();
- else
- currentBlock.restoreDefaultButtons();
-
- // Disable/Enable table
- currentBlock.getRemoteICviewer().getTable().setEnabled(!isRemoteHelpDisabled);
+ changeListener.handleEvent(null);
}
/*
@@ -211,18 +226,12 @@ public class HelpContentPreferencePage extends PreferencePage implements
*/
private Listener changeListener = new Listener() {
public void handleEvent(Event event) {
-
- HelpContentBlock currentBlock=remoteICPage.getHelpContentBlock();
boolean isRemoteHelpEnabled = !(searchLocalHelpOnly.getSelection());
- // Disable/Enable buttons
- if(isRemoteHelpEnabled)
- currentBlock.restoreDefaultButtons();
- else
- currentBlock.disableAllButtons();
// Disable/Enable table
- currentBlock.getRemoteICviewer().getTable().setEnabled(isRemoteHelpEnabled);
+ table.getTable().setEnabled(isRemoteHelpEnabled);
+ buttons.setEnabled(isRemoteHelpEnabled);
}
};
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IC.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IC.java
new file mode 100644
index 0000000..f28d41f
--- /dev/null
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IC.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.preferences;
+
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.UnknownHostException;
+
+/**
+ * Information Center (IC) - stores URL info.
+ *
+ * @author chaustin
+ *
+ */
+public class IC {
+
+ private String name;
+ private boolean enabled;
+ private String protocol;
+ private String host;
+ private String path;
+ private int port = -1;
+
+
+ public IC(String name,String href,boolean enabled) throws MalformedURLException
+ {
+ this.name = name;
+ this.enabled = enabled;
+ setHref(href);
+ }
+
+ public void setHref(String href) throws MalformedURLException
+ {
+ if (href.startsWith(":")) //$NON-NLS-1$
+ href = "http"+href; //$NON-NLS-1$
+
+ setHref(new URL(href));
+ }
+
+ public void setHref(URL url)
+ {
+ this.protocol = url.getProtocol();
+ this.host = url.getHost();
+ this.path = url.getPath();
+ this.port = url.getPort();
+ if (port==-1)
+ {
+ if (protocol.equals("http")) //$NON-NLS-1$
+ port = 80;
+ else if (protocol.equals("https")) //$NON-NLS-1$
+ port = 443;
+ }
+ }
+
+ public String getHref()
+ {
+ String portString = ":"+port; //$NON-NLS-1$
+ if (port==80 && protocol.equals("http")) //$NON-NLS-1$
+ portString = ""; //$NON-NLS-1$
+ else if (port==443 && protocol.equals("https")) //$NON-NLS-1$
+ portString = ""; //$NON-NLS-1$
+
+ return protocol+"://"+host+portString+path; //$NON-NLS-1$
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String toString()
+ {
+ return name+" ("+getHref()+")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Tests to see if 2 ICs are equal. The state (enabled or disabled) is ignored
+ * during this operation.
+ *
+ */
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof IC))
+ return false;
+
+ IC candidate = (IC)o;
+
+ if (getName().equals(candidate.getName())
+ && getPath().equals(candidate.getPath())
+ && getPort()==candidate.getPort()
+ && getProtocol().equals(candidate.getProtocol()))
+ {
+ try {
+ InetAddress host1 = InetAddress.getByName(getHost());
+ InetAddress host2 = InetAddress.getByName(candidate.getHost());
+
+ if (host1.getHostAddress().equals(host2.getHostAddress()))
+ return true;
+ } catch (UnknownHostException e) {
+ if (getHost().equals(candidate.getHost()))
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java
new file mode 100644
index 0000000..9de49f6
--- /dev/null
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java
@@ -0,0 +1,279 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.preferences;
+
+
+import java.util.List;
+
+import org.eclipse.help.ui.internal.Messages;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+
+public class ICButtons implements SelectionListener{
+
+ private HelpContentPreferencePage page;
+
+ private Button addIC;
+ private Button editIC;
+ private Button removeIC;
+ private Button moveUp;
+ private Button moveDown;
+ private Button testIC;
+ private Button enableIC;
+
+ private boolean enabled = true;
+
+ public ICButtons(Composite parent,HelpContentPreferencePage page)
+ {
+ this.page = page;
+
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ container.setLayout(layout);
+ container.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ container.setFont(parent.getFont());
+
+ addIC = createPushButton(container, Messages.HelpContentBlock_addICTitle);
+ editIC = createPushButton(container, Messages.HelpContentBlock_editICTitle);
+ removeIC = createPushButton(container, Messages.HelpContentBlock_removeICTitle);
+ testIC = createPushButton(container, Messages.HelpContentBlock_testConnectionTitle);
+
+ String enableTitle = Messages.HelpContentBlock_3.length() > Messages.HelpContentBlock_4.length() ?
+ Messages.HelpContentBlock_3 : Messages.HelpContentBlock_4;
+ enableIC = createPushButton(container, enableTitle);
+ moveUp = createPushButton(container, Messages.HelpContentBlock_upTitle);
+ moveDown = createPushButton(container, Messages.HelpContentBlock_downTitle);
+
+ page.getTable().getTable().addSelectionListener(this);
+
+
+ updateButtonStates();
+ }
+
+ public void setEnabled(boolean enabled)
+ {
+ this.enabled = enabled;
+ updateButtonStates();
+ }
+
+ public Button createPushButton(Composite parent, String buttonText) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setFont(parent.getFont());
+ button.setText(buttonText);
+ button.addSelectionListener(this);
+ page.setButtonLayoutData(button);
+ return button;
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (e.getSource() instanceof Button)
+ {
+ if (e.getSource()==addIC)
+ addIC();
+ else if (e.getSource()==editIC)
+ editIC();
+ else if (e.getSource()==removeIC)
+ removeIC();
+ else if (e.getSource()==testIC)
+ testIC();
+ else if (e.getSource()==enableIC)
+ enableIC();
+ else if (e.getSource()==moveUp)
+ move(-1);
+ else if (e.getSource()==moveDown)
+ move(1);
+ }
+ else if (e.getSource() instanceof Table)
+ updateButtonStates();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ if (e.getSource() instanceof Table)
+ editIC();
+ }
+
+ public void addIC()
+ {
+ ICDialog dialog = new ICDialog(page.getShell());
+ if (dialog.open() == Window.OK) {
+ page.getTable().addIC(dialog.getIC());
+ updateButtonStates();
+ }
+ }
+
+ public void editIC()
+ {
+ IStructuredSelection selection = (IStructuredSelection)page.getTable().getSelection();
+ IC ic = (IC)selection.getFirstElement();
+ if (ic==null)
+ return;
+
+ ICDialog dialog = new ICDialog(page.getShell(),ic);
+
+ if (dialog.open() == Window.OK) {
+ page.getTable().editIC(dialog.getIC());
+ updateButtonStates();
+ }
+ }
+
+ public void removeIC()
+ {
+ IStructuredSelection selection = (IStructuredSelection)page.getTable().getSelection();
+ List ics = selection.toList();
+ String remove = ""; //$NON-NLS-1$
+
+ for (int i=0;i<ics.size();i++)
+ {
+ remove+="\n"+ics.get(i); //$NON-NLS-1$
+ }
+
+ boolean shouldRemove =
+ MessageDialog.openQuestion(
+ page.getShell(),
+ NLS.bind(Messages.HelpContentBlock_rmvTitle ,""), //$NON-NLS-1$
+ NLS.bind(Messages.HelpContentBlock_rmvLabel ,remove));
+
+ if (shouldRemove)
+ {
+ for (int i=0;i<ics.size();i++)
+ page.getTable().removeIC((IC)ics.get(i));
+ updateButtonStates();
+ }
+ }
+
+ public void testIC()
+ {
+ IStructuredSelection selection = (IStructuredSelection)page.getTable().getSelection();
+ IC ic = (IC)selection.getFirstElement();
+ if (ic==null)
+ return;
+
+ ICDialog dialog = new ICDialog(page.getShell(),ic,true);
+
+ if (dialog.open() == Window.OK) {
+ page.getTable().editIC(dialog.getIC());
+ updateButtonStates();
+ }
+
+
+/* boolean connected = TestConnectionUtility.testConnection(ic.getHost(),
+ ic.getPort()+"", ic.getPath(),ic.getProtocol());
+ TestICDialog dialog = new TestICDialog(page.getShell(),ic);
+ dialog.setConnectionStatus(connected);
+ dialog.open();
+*/
+ }
+
+ public void enableIC()
+ {
+ int indexes[] = page.getTable().getTable().getSelectionIndices();
+ IStructuredSelection selection = (IStructuredSelection)page.getTable().getSelection();
+ List ics = selection.toList();
+
+ boolean enable = enableIC.getText().equals(Messages.HelpContentBlock_4);
+
+ for (int i=0;i<ics.size();i++)
+ {
+ ((IC)ics.get(i)).setEnabled(enable);
+ page.getTable().getTableViewer().replace((IC)ics.get(i),indexes[i]);
+ }
+ page.getTable().refresh();
+
+ updateButtonStates();
+ }
+
+ public void move(int offset)
+ {
+ int index = page.getTable().getTable().getSelectionIndices()[0];
+
+ List ics = page.getTable().getICs();
+ IC x = (IC) ics.get(index);
+ IC y = (IC) ics.get(index+offset);
+
+ ics.set(index+offset,x);
+ ics.set(index,y);
+
+
+ page.getTable().getTableViewer().getContentProvider().inputChanged(
+ page.getTable().getTableViewer(), null, ics);
+
+ page.getTable().getTableViewer().replace(x,index+offset);
+ page.getTable().getTableViewer().replace(y,index);
+ page.getTable().refresh();
+
+ page.getTable().getTable().deselectAll();
+ page.getTable().getTable().select(index+offset);
+ updateButtonStates();
+
+ }
+
+ public void updateButtonStates()
+ {
+ if (!enabled)
+ {
+ editIC.setEnabled(false);
+ testIC.setEnabled(false);
+ moveUp.setEnabled(false);
+ moveDown.setEnabled(false);
+ enableIC.setEnabled(false);
+ addIC.setEnabled(false);
+ removeIC.setEnabled(false);
+ return;
+ }
+
+ addIC.setEnabled(true);
+
+ IC firstIC = (IC)(((IStructuredSelection)page.getTable().getSelection()).getFirstElement());
+ if (firstIC!=null)
+ {
+ int index = page.getTable().getTable().getSelectionIndices()[0];
+ enableIC.setText(firstIC.isEnabled() ? Messages.HelpContentBlock_3 : Messages.HelpContentBlock_4);
+
+ if (page.getTable().getTable().getSelectionIndices().length==1)
+ {
+ editIC.setEnabled(true);
+ testIC.setEnabled(true);
+ moveUp.setEnabled(index!=0);
+ moveDown.setEnabled(index!=page.getTable().getICs().size()-1);
+ }
+ else
+ {
+ editIC.setEnabled(false);
+ testIC.setEnabled(false);
+ moveUp.setEnabled(false);
+ moveDown.setEnabled(false);
+ }
+ removeIC.setEnabled(true);
+ enableIC.setEnabled(true);
+ }
+ else
+ {
+ editIC.setEnabled(false);
+ testIC.setEnabled(false);
+ moveUp.setEnabled(false);
+ moveDown.setEnabled(false);
+ removeIC.setEnabled(false);
+ enableIC.setEnabled(false);
+ }
+ }
+}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java
new file mode 100644
index 0000000..e761b5b
--- /dev/null
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.preferences;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.help.internal.base.util.TestConnectionUtility;
+import org.eclipse.help.ui.internal.Messages;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+
+public class ICDialog extends StatusDialog implements IShellProvider, Listener, SelectionListener {
+
+ private IC ic = null;
+
+ private Text nameText;
+ private Text hrefText;
+
+ private Button testButton;
+
+ private boolean testConnect = false;
+
+ public ICDialog(Shell parentShell) {
+ this(parentShell,null,false);
+ }
+ public ICDialog(Shell parentShell, IC initialIC) {
+ this(parentShell,initialIC,false);
+ }
+ public ICDialog(Shell parentShell, IC initialIC,boolean testConnect) {
+ super(parentShell);
+ this.ic = initialIC;
+ this.testConnect = testConnect;
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+ "org.eclipse.help.ui.prefPageHelpContent"); //$NON-NLS-1$
+
+ Composite top = (Composite) super.createDialogArea(parent);
+ top.setSize(top.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+
+ Composite topGroup = new Composite(top, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 2;
+ layout.marginWidth = 2;
+ layout.makeColumnsEqualWidth = false;
+ topGroup.setLayout(layout);
+ topGroup.setFont(top.getFont());
+ topGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+
+ Label label = new Label(topGroup, SWT.NONE);
+ label.setText(Messages.AddICDialog_4);
+
+ nameText = new Text(topGroup, SWT.BORDER);
+ nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ if (nameText.getOrientation() == SWT.RIGHT_TO_LEFT)
+ nameText.setOrientation(SWT.LEFT_TO_RIGHT);
+ nameText.addListener(SWT.Modify, this);
+
+ label = new Label(topGroup, SWT.NONE);
+ label.setText(Messages.InfoCenterPage_url);
+
+ hrefText = new Text(topGroup, SWT.BORDER);
+ hrefText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ if (hrefText.getOrientation() == SWT.RIGHT_TO_LEFT)
+ hrefText.setOrientation(SWT.LEFT_TO_RIGHT);
+ hrefText.addListener(SWT.Modify, this);
+
+
+ if (ic!=null)
+ {
+ nameText.setText(ic.getName());
+ hrefText.setText(ic.getHref());
+ this.getShell().setText(NLS.bind(Messages.EditICDialog_7, ic.getName()));
+ }
+ else
+ this.getShell().setText(Messages.AddICDialog_2);
+
+
+ Dialog.applyDialogFont(top);
+ return top;
+
+ }
+
+ protected void createButtonsForButtonBar(Composite parent) {
+
+ testButton = this.createButton(
+ parent,
+ IDialogConstants.CLIENT_ID,
+ Messages.HelpContentBlock_testConnectionTitle,
+ true);
+ testButton.addSelectionListener(this);
+ super.createButtonsForButtonBar(parent);
+
+
+ //Initialize validity
+ updateValidity();
+
+ if (testConnect)
+ testConnection();
+ }
+
+
+ public void initializeBounds() {
+ Point size = getInitialSize();
+ Point location = getInitialLocation(size);
+ this.getShell().setBounds(location.x, location.y,
+ size.x + 180, size.y);
+ }
+
+ public void okPressed() {
+ try {
+ String href = formalizeHref(hrefText.getText());
+
+ ic = new IC(nameText.getText(),href,true);
+ } catch (MalformedURLException e) {} // This should never happen since we test in updateValidity
+ this.setReturnCode(OK);
+ this.close();
+ }
+
+ public String formalizeHref(String href)
+ {
+ if (href.endsWith("/index.jsp")) //$NON-NLS-1$
+ href = href.substring(0,href.lastIndexOf("/index.jsp")); //$NON-NLS-1$
+ else if (href.endsWith("/site/site.xml")) //$NON-NLS-1$
+ href = href.substring(0,href.lastIndexOf("/site/site.xml")); //$NON-NLS-1$
+
+ return href;
+ }
+
+ /*
+ * Checks for errors in the user input and shows/clears the error message
+ * as appropriate.
+ */
+ private void updateValidity() {
+
+ IStatus status = Status.OK_STATUS;
+
+ if (nameText!=null && nameText.getText().equals("")) //$NON-NLS-1$
+ status = new Status(IStatus.ERROR,"org.eclipse.help.ui",Messages.InfoCenterPage_invalidURL); //$NON-NLS-1$
+ else if (hrefText!=null)
+ {
+ try {
+ String href = hrefText.getText();
+ new URL(href);
+
+ if (!href.matches(".*\\://.+/.+")) //$NON-NLS-1$
+ status = new Status(IStatus.ERROR,"org.eclipse.help.ui",Messages.InfoCenterPage_invalidURL); //$NON-NLS-1$
+
+ } catch (MalformedURLException e) {
+ status = new Status(IStatus.ERROR,"org.eclipse.help.ui",Messages.InfoCenterPage_invalidURL); //$NON-NLS-1$
+ }
+ }
+
+// if (testButton!=null)
+// testButton.setEnabled(status.isOK());
+
+ this.updateStatus(status);
+ }
+
+ private void testConnection()
+ {
+ IC testIC;
+ IStatus status;
+ try {
+ testIC = new IC(nameText.getText(),formalizeHref(hrefText.getText()),true);
+ boolean connected = TestConnectionUtility.testConnection(testIC.getHost(),
+ testIC.getPort()+"", testIC.getPath(),testIC.getProtocol()); //$NON-NLS-1$
+
+
+ if(connected)
+ status = new Status(IStatus.INFO,"org.eclipse.help.ui",Messages.TestConnectionDialog_12); //$NON-NLS-1$
+ else
+ status = new Status(IStatus.WARNING,"org.eclipse.help.ui",Messages.TestConnectionDialog_13); //$NON-NLS-1$
+
+ } catch (MalformedURLException e) {
+
+ status = new Status(IStatus.WARNING,"org.eclipse.help.ui",Messages.TestConnectionDialog_13); //$NON-NLS-1$
+ }
+
+
+ updateStatus(status);
+
+ this.getOKButton().setEnabled(true);
+ this.getCancelButton().setEnabled(true);
+
+ }
+
+ public IC getIC()
+ {
+ return ic;
+ }
+
+ public void handleEvent(Event event) {
+ updateValidity();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ if (e.getSource() instanceof Button)
+ testConnection();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICPreferences.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICPreferences.java
new file mode 100644
index 0000000..8941b31
--- /dev/null
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICPreferences.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.preferences;
+
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.help.internal.HelpPlugin;
+import org.eclipse.help.internal.base.HelpBasePlugin;
+import org.eclipse.help.internal.base.IHelpBaseConstants;
+import org.eclipse.help.internal.base.remote.PreferenceFileHandler;
+import org.eclipse.help.internal.base.remote.RemoteHelp;
+import org.eclipse.help.internal.base.remote.RemoteIC;
+import org.osgi.service.prefs.BackingStoreException;
+
+
+public class ICPreferences {
+
+ public final static String DELIMITER = ","; //$NON-NLS-1$
+
+
+ public static void setICs(List ics)
+ {
+ String name = "", host = "", path = "", protocol="", port = "", enabled = ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+
+ for (int i=0;i<ics.size();i++)
+ {
+ name+= ((IC)ics.get(i)).getName()+DELIMITER;
+ protocol+= ((IC)ics.get(i)).getProtocol()+DELIMITER;
+ host+= ((IC)ics.get(i)).getHost()+DELIMITER;
+ port+= ((IC)ics.get(i)).getPort()+DELIMITER;
+ path+= ((IC)ics.get(i)).getPath()+DELIMITER;
+ enabled+= ((IC)ics.get(i)).isEnabled()+DELIMITER;
+ }
+
+ // Remove trailing commas
+ if(ics.size()!=0)
+ {
+ name = name.substring(0,name.length()-1);
+ protocol = protocol.substring(0,protocol.length()-1);
+ host = host.substring(0,host.length()-1);
+ port = port.substring(0,port.length()-1);
+ path = path.substring(0,path.length()-1);
+ enabled = enabled.substring(0,enabled.length()-1);
+ }
+
+ set("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_NAME, name); //$NON-NLS-1$
+ set("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_HOST, host); //$NON-NLS-1$
+ set("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PATH, path); //$NON-NLS-1$
+ set("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PROTOCOL, protocol); //$NON-NLS-1$
+ set("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PORT, port); //$NON-NLS-1$
+ set("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_ICEnabled, enabled); //$NON-NLS-1$
+
+ HelpPlugin.getTocManager().clearCache();
+ }
+
+ public static List getICs()
+ {
+ return prefsToICs(
+ ICPreferences.get("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_NAME).split(DELIMITER), //$NON-NLS-1$
+ ICPreferences.get("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PROTOCOL).split(DELIMITER), //$NON-NLS-1$
+ ICPreferences.get("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_HOST).split(DELIMITER), //$NON-NLS-1$
+ ICPreferences.get("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PORT).split(DELIMITER), //$NON-NLS-1$
+ ICPreferences.get("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PATH).split(DELIMITER), //$NON-NLS-1$
+ ICPreferences.get("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_ICEnabled).split(DELIMITER)); //$NON-NLS-1$
+ }
+
+ public static List prefsToICs(String names[],String protocols[],String hosts[],String ports[],String paths[],String states[])
+ {
+ List ics = new ArrayList();
+
+ for (int i=0;i<names.length;i++)
+ {
+ if (!names[i].equals("")) //$NON-NLS-1$
+ {
+ try {
+ IC ic = new IC(
+ names[i],
+ (protocols.length>i ? protocols[i] : "http") + "://" + //$NON-NLS-1$ //$NON-NLS-2$
+ hosts[i]+":"+ //$NON-NLS-1$
+ ports[i]+
+ paths[i],
+ Boolean.parseBoolean(states[i]));
+ ics.add(ic);
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ return ics;
+ }
+
+
+
+ public static List getDefaultICs()
+ {
+ return prefsToICs(
+ getDefault("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_NAME).split(DELIMITER), //$NON-NLS-1$
+ getDefault("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PROTOCOL).split(DELIMITER), //$NON-NLS-1$
+ getDefault("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_HOST).split(DELIMITER), //$NON-NLS-1$
+ getDefault("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PORT).split(DELIMITER), //$NON-NLS-1$
+ getDefault("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PATH).split(DELIMITER), //$NON-NLS-1$
+ getDefault("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_ICEnabled).split(DELIMITER)); //$NON-NLS-1$
+ }
+
+
+ /**
+ * Returns a default preference for the given name
+ *
+ * @param plugin - Name of the plugin containing this preference
+ * @param name - Name of the preference to retrieve
+ * @return value, or empty string if no preference found
+ */
+ public static String getDefault(String plugin,String name)
+ {
+ return getDefaultNode(plugin).get(name, ""); //$NON-NLS-1$
+ }
+
+ public static void setRemoteHelp(boolean enabled)
+ {
+ set("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_ON,enabled+""); //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.getTocManager().clearCache();
+ }
+
+ public static void setRemoteHelpPreferred(boolean remotePreferred)
+ {
+ set("org.eclipse.help.base",IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED,remotePreferred+""); //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.getTocManager().clearCache();
+ }
+
+ /**
+ * Sets a preference
+ *
+ * @param plugin - Name of the plugin containing this preference
+ * @param name - Name of the preference
+ * @param value - Value to set
+ */
+ public static void set(String plugin,String name,String value)
+ {
+ set(getNode(plugin),name,value);
+ }
+
+ /**
+ * Set a preference in the given node.
+ *
+ * @param node
+ * @param name
+ * @param value
+ */
+ public static void set(IEclipsePreferences node,String name,String value)
+ {
+ node.put(name, value);
+ try {
+ node.flush();
+ } catch (BackingStoreException e) {} //Nothing we can do, move on
+ }
+
+ /**
+ * Returns the preference found for the given name
+ *
+ * @param plugin - Name of the plugin containing this preference
+ * @param name - Name of the preference to retrieve
+ * @return value, or empty string if no preference found
+ */
+ public static String get(String plugin,String name)
+ {
+ return getNode(plugin).get(name, ""); //$NON-NLS-1$
+ }
+
+ /**
+ * Get the IEclipsePreferences node for the given plugin
+ *
+ * @param plugin
+ * @return
+ */
+ public static IEclipsePreferences getNode(String plugin)
+ {
+ IEclipsePreferences p = InstanceScope.INSTANCE.getNode(plugin);
+ return p;
+ }
+
+
+ /**
+ * Get the default IEclipsePreferences node for the given plugin
+ *
+ * @param plugin
+ * @return
+ */
+ public static IEclipsePreferences getDefaultNode(String plugin)
+ {
+ IEclipsePreferences p = DefaultScope.INSTANCE.getNode(plugin);
+ return p;
+ }
+}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java
new file mode 100644
index 0000000..de960ab
--- /dev/null
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.preferences;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.help.internal.base.remote.RemoteIC;
+import org.eclipse.help.ui.internal.Messages;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+public class ICTable {
+
+ private Table table;
+ private TableViewer viewer;
+
+ private final String NAME_COLUMN = Messages.RemoteICViewer_Name;
+ private final String LOCATION_COLUMN = Messages.RemoteICViewer_URL;
+ private final String STATUS_COLUMN = Messages.RemoteICViewer_Enabled;
+
+ // Set column names
+ private String[] columnNames = new String[] {NAME_COLUMN,
+ LOCATION_COLUMN, STATUS_COLUMN};
+
+
+ public ICTable(Composite parent) {
+
+ // Create the table
+ table = createTable(parent);
+ // Create and setup the TableViewer
+ viewer = createTableViewer();
+
+ loadPreferences();
+ }
+
+ /**
+ * Release resources
+ */
+ public void dispose() {
+ // Tell the label provider to release its resources
+ viewer.getLabelProvider().dispose();
+ }
+
+ /**
+ * Create the Table
+ */
+ private Table createTable(Composite parent) {
+ int style = SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION;
+
+ TableLayout tableLayout = new TableLayout();
+ Table table = new Table(parent, style);
+ table.setLayout(tableLayout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setFont(parent.getFont());
+
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.grabExcessVerticalSpace = true;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.verticalAlignment = GridData.FILL;
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ gridData.heightHint = table.getItemHeight();
+ gridData.horizontalSpan = 1;
+ table.setLayoutData(gridData);
+
+
+
+ ColumnLayoutData[] fTableColumnLayouts= {
+ new ColumnWeightData(85),
+ new ColumnWeightData(165),
+ new ColumnWeightData(60)
+ };
+
+ TableColumn column;
+
+ tableLayout.addColumnData(fTableColumnLayouts[0]);
+ column = new TableColumn(table, SWT.NONE, 0);
+ column.setResizable(fTableColumnLayouts[0].resizable);
+ column.setText(NAME_COLUMN);
+
+ tableLayout.addColumnData(fTableColumnLayouts[1]);
+ column = new TableColumn(table, SWT.NONE, 1);
+ column.setResizable(fTableColumnLayouts[1].resizable);
+ column.setText(LOCATION_COLUMN);
+
+ tableLayout.addColumnData(fTableColumnLayouts[2]);
+ column = new TableColumn(table, SWT.NONE, 2);
+ column.setResizable(fTableColumnLayouts[2].resizable);
+ column.setText(STATUS_COLUMN);
+
+ return table;
+ }
+
+ /**
+ * Create the TableViewer
+ */
+ private TableViewer createTableViewer() {
+
+ TableViewer viewer = new TableViewer(table);
+ viewer.setUseHashlookup(true);
+ viewer.setColumnProperties(columnNames);
+ viewer.setContentProvider(new ICContentProvider());
+ viewer.setLabelProvider(new ICLabelProvider());
+ return viewer;
+ }
+
+ /**
+ * Proxy for the the RemoteICList which provides content
+ * for the Table. This class implements IRemoteHelpListViewer interface an
+ * registers itself with RemoteICList
+ */
+ class ICContentProvider implements IStructuredContentProvider
+ {
+ private List content = new ArrayList();
+
+ public void dispose() {
+ content = null;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ content = (List)newInput;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return (Object[])content.toArray(new Object[content.size()]);
+ }
+
+ }
+
+ public class ICLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return ((IC)element).getName();
+ case 1:
+ return ((IC)element).getHref();
+ case 2:
+ return ((IC)element).isEnabled() ? Messages.RemoteICLabelProvider_4 : Messages.RemoteICLabelProvider_5;
+ default:
+ return null;
+ }
+ }
+
+ }
+
+
+
+
+ /**
+ * @param rics the ordered remote InfoCenters
+ */
+ public void update(List ics) {
+ viewer.getContentProvider().inputChanged(viewer, null, ics);
+ refresh();
+ }
+
+ /**
+ * Make sure the table viewer shows the latest copy of the ordered InfoCenters
+ */
+ public void refresh() {
+ viewer.refresh(getICs());
+ }
+
+ /**
+ * Return the column names in a collection
+ *
+ * @return List containing column names
+ */
+ public List getColumnNames() {
+ return Arrays.asList(columnNames);
+ }
+
+ /**
+ * @return currently selected item
+ */
+ public ISelection getSelection() {
+ return viewer.getSelection();
+ }
+
+ /**
+ * Return the RemoteICList
+ */
+ public List getICs() {
+ ICContentProvider p = (ICContentProvider)viewer.getContentProvider();
+ Object objs[] = p.getElements(null);
+ List content = new ArrayList();
+ for (int o=0;o<objs.length;o++)
+ content.add(objs[o]);
+ return content;
+ }
+
+ public void setICs(List ics)
+ {
+ List oldICs = getICs();
+ for (int o=0;o<oldICs.size();o++)
+ removeIC((IC)oldICs.get(o));
+
+ for (int i=0;i<ics.size();i++)
+ addIC((IC)ics.get(i));
+ }
+
+ public TableViewer getTableViewer()
+ {
+ return viewer;
+ }
+ /**
+ * Return the parent composite
+ */
+ public Control getControl() {
+ return table.getParent();
+ }
+
+ public Table getTable() {
+ return table;
+ }
+
+ public void addIC(IC ic)
+ {
+ List content = getICs();
+ content.add(ic);
+ getTableViewer().getContentProvider().inputChanged(
+ getTableViewer(), null, content);
+ getTableViewer().add(ic);
+ refresh();
+ }
+
+ public void editIC(IC ic)
+ {
+ List content = getICs();
+ content.set(getTable().getSelectionIndex(), ic);
+ getTableViewer().replace(ic,getTable().getSelectionIndex());
+ getTableViewer().getContentProvider().inputChanged(
+ getTableViewer(), null, content);
+ refresh();
+ }
+
+ public void removeIC(IC ic)
+ {
+ List content = getICs();
+ content.remove(ic);
+ getTableViewer().getContentProvider().inputChanged(getTableViewer(), null, content);
+ getTableViewer().remove(ic);
+ refresh();
+ }
+
+ private void loadPreferences()
+ {
+ List ics = ICPreferences.getICs();
+ for (int i=0;i<ics.size();i++)
+ addIC((IC)ics.get(i));
+ }
+
+}