Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/AddICDialog.java354
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/EditICDialog.java378
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentBlock.java463
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java24
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IHelpContentBlockContainer.java51
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IRemoteHelpListViewer.java49
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/InfocenterDisplay.java86
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICLabelProvider.java57
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICList.java210
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICViewer.java240
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/StatusInfo.java174
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/TestConnectionDialog.java157
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ViewICPropsDialog.java261
13 files changed, 22 insertions, 2482 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/AddICDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/AddICDialog.java
deleted file mode 100644
index fe4dc599b..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/AddICDialog.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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 org.eclipse.help.ui.internal.Messages;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.StatusDialog;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-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.Combo;
-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 AddICDialog extends StatusDialog implements IShellProvider {
-
- private Label nameLabel;
-
- private Text nameText;
-
- private Label hostLabel;
-
- private Text hostText;
-
- private Label pathLabel;
-
- private Text pathText;
-
- private Label protocolLabel;
-
- private Combo protocolCombo;
-
- private Button radio1;
-
- private Button radio2;
-
- private Text portText;
-
- Point shellSize;
-
- Point shellLocation;
-
- private String enteredHost;
-
- private String enteredName;
-
- private String enteredPort;
-
- private String enteredPath;
-
- private String enteredProtocol;
-
- private boolean enteredUseDefault;
-
- private Color errorColor;
-
- private StatusInfo dialogStatus;
-
- private static final String PROTOCOL_HTTPS = "https"; //$NON-NLS-1$
-
- public AddICDialog(Shell parentShell) {
-
- super(parentShell);
- // TODO Auto-generated constructor stub
- }
-
- /*
- * Listens for any change in the UI and checks for valid input and correct
- * enablement.
- */
- private Listener changeListener = new Listener() {
- public void handleEvent(Event event) {
-
- updateValidity();
- }
- };
-
- protected Control createDialogArea(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- "org.eclipse.help.ui.prefPageHelpContent"); //$NON-NLS-1$
-
- Composite topComposite= (Composite) super.createDialogArea(parent);
- topComposite.setSize(topComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- Composite topGroup = new Composite(topComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.makeColumnsEqualWidth = false;
- topGroup.setLayout(layout);
- topGroup.setFont(topComposite.getFont());
- topGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // add controls to composite as necessary
- createNameSection(topGroup);
- createHostSection(topGroup);
- createPathSection(topGroup);
- createProtocolSection(topGroup);
- createPortSection(topGroup);
-
- //Initialize validity
- updateValidity();
-
- Dialog.applyDialogFont(topComposite);
- return topComposite;
-
- }
-
- public void initializeBounds() {
- shellSize = getInitialSize();
- shellLocation = getInitialLocation(shellSize);
-
- this.getShell().setBounds(shellLocation.x, shellLocation.y,
- shellSize.x + 150, shellSize.y);
- //shellSize.x + 150, shellSize.y-80);
- this.getShell().setText(Messages.AddICDialog_2);
- }
-
- /*
- * Create the "Name:" label and text field.
- */
- private void createNameSection(Composite parent) {
- nameLabel = new Label(parent, SWT.NONE);
- nameLabel.setText(Messages.AddICDialog_4);
- nameText = new Text(parent, 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, changeListener);
- }
-
- /*
- * Create the "Host:" label and text field.
- */
- private void createHostSection(Composite parent) {
- hostLabel = new Label(parent, SWT.NONE);
- hostLabel.setText(Messages.AddICDialog_5);
- hostText = new Text(parent, SWT.BORDER);
- hostText.setText(""); //$NON-NLS-1$
- hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- if (hostText.getOrientation() == SWT.RIGHT_TO_LEFT)
- hostText.setOrientation(SWT.LEFT_TO_RIGHT);
- hostText.addListener(SWT.Modify, changeListener);
- }
-
- /*
- * Create the "Path:" label and text field.
- */
- private void createPathSection(Composite parent) {
- pathLabel = new Label(parent, SWT.NONE);
- pathLabel.setText(Messages.AddICDialog_7);
- pathText = new Text(parent, SWT.BORDER);
- pathText.setText("/help"); //$NON-NLS-1$
- pathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- if (pathText.getOrientation() == SWT.RIGHT_TO_LEFT)
- pathText.setOrientation(SWT.LEFT_TO_RIGHT);
- pathText.addListener(SWT.Modify, changeListener);
- }
-
- /*
- * Create the "Protocol:" label and combo box.
- */
- private void createProtocolSection(Composite parent) {
- protocolLabel = new Label(parent, SWT.NONE);
- protocolLabel.setText(Messages.AddICDialog_8);
- protocolCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
- protocolCombo.add("http"); //$NON-NLS-1$
- protocolCombo.add(PROTOCOL_HTTPS);
- protocolCombo.select(0);
- }
-
- /*
- * Create the port radio buttons, and text field.
- */
- private void createPortSection(Composite parent) {
- Composite portComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- portComposite.setLayout(layout);
- portComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
- false, 2, 1));
-
- radio1 = new Button(portComposite, SWT.RADIO);
- radio1.setText(Messages.AddICDialog_9);
- radio1.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false,
- false, 2, 1));
- radio1.addListener(SWT.Selection, changeListener);
- radio1.setSelection(true);
-
- radio2 = new Button(portComposite, SWT.RADIO);
- radio2.setText(Messages.AddICDialog_10);
- radio2.addListener(SWT.Selection, changeListener);
-
- portText = new Text(portComposite, SWT.BORDER);
- portText.setLayoutData(new GridData(50, SWT.DEFAULT));
- portText.addListener(SWT.Modify, changeListener);
- portText.setEnabled(false);
- }
-
- public String getEnteredHost() {
-
- return enteredHost;
- }
-
- public String getEnteredPath() {
-
- return enteredPath;
- }
-
- public String getEnteredProtocol() {
-
- return enteredProtocol;
- }
-
- public String getEnteredPort() {
-
- return enteredPort;
- }
-
- public String getEnteredName() {
- return enteredName;
- }
-
- public boolean getEnteredDefault() {
- return enteredUseDefault;
- }
-
- public void okPressed() {
- enteredHost = hostText.getText();
- enteredName = nameText.getText();
- enteredPath = pathText.getText();
- enteredProtocol = protocolCombo.getText();
-
- // Logic here for setting port values
- if (radio1.getSelection()) // Use Default
- {
- enteredUseDefault = true;
- enteredPort = "80"; //$NON-NLS-1$
- } else // Custom Port
- {
- enteredUseDefault = false;
- enteredPort = portText.getText();
-
- }
- this.setReturnCode(OK);
-
- //Dispose Color object
- if(errorColor!=null)
- {
- errorColor.dispose();
- }
-
- //Close window
- this.close();
-
-
- }
-
-
- /*
- * Checks for errors in the user input and shows/clears the error message
- * as appropriate.
- */
- private void updateValidity() {
- // no checking needed if remote not selected
- String errorMessage=""; //$NON-NLS-1$
- boolean errorFound=false;
- dialogStatus = new StatusInfo();
-
- // check for empty hostname
- if (hostText!=null && hostText.getText().equals("")) //$NON-NLS-1$
- {
- if(!errorFound)
- {
- errorMessage=Messages.AddICDialog_17;
- dialogStatus.setError(errorMessage);
- errorFound=true;
- }
-
- }
- // check for invalid port
- if (radio2!=null && radio2.getSelection() == true) {
- try {
- portText.setEnabled(true);
- // check port range
- int port = Integer.parseInt(portText.getText());
- if (port < 0 || port > 65535) {
-
- if(!errorFound)
- {
- errorMessage=Messages.AddICDialog_19;
- dialogStatus.setError(errorMessage);
- errorFound=true;
- }
-
-
- }
- }
- catch (NumberFormatException e) {
- // not a number
- if(!errorFound)
- {
- errorMessage=Messages.AddICDialog_19;
- dialogStatus.setError(errorMessage);
- errorFound=true;
- }
-
- }
- }
- else
- {
- if(radio1!=null && radio1.getSelection())
- {
- portText.setEnabled(false);
- }
-
- }
-
-
- if(errorFound)
- {
- this.updateStatus(dialogStatus);
- }
- else
- {
- dialogStatus.setOK();
- this.updateStatus(dialogStatus);
-
- }
- }
-
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/EditICDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/EditICDialog.java
deleted file mode 100644
index b9346ff7c..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/EditICDialog.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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 org.eclipse.help.ui.internal.Messages;
-import org.eclipse.jface.dialogs.Dialog;
-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.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.Combo;
-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 EditICDialog extends StatusDialog implements IShellProvider {
-
- private Label nameLabel;
-
- private Text nameText;
-
- private Label hostLabel;
-
- private Text hostText;
-
- private Label pathLabel;
-
- private Text pathText;
-
- private Label protocolLabel;
-
- private Combo protocolCombo;
-
- private Button radio1;
-
- private Button radio2;
-
- private Text portText;
-
- Point shellSize;
-
- Point shellLocation;
-
- private String infoCenterName = ""; //$NON-NLS-1$
-
- private String selectedName = ""; //$NON-NLS-1$
-
- private String selectedHost = ""; //$NON-NLS-1$
-
- private String selectedPort = ""; //$NON-NLS-1$
-
- private String selectedPath = ""; //$NON-NLS-1$
-
- private String selectedProtocol = ""; //$NON-NLS-1$
-
- private String enteredHost;
-
- private String enteredName;
-
- private String enteredPort;
-
- private String enteredPath;
-
- private String enteredProtocol;
-
- private String enteredUseDefault;
-
- private StatusInfo dialogStatus;
-
- private static final String PROTOCOL_HTTP = "http"; //$NON-NLS-1$
- private static final String PROTOCOL_HTTPS = "https"; //$NON-NLS-1$
-
- public EditICDialog(Shell parentShell, String infoCenterName) {
-
- super(parentShell);
- this.infoCenterName = infoCenterName;
- }
-
- /*
- * Listens for any change in the UI and checks for valid
- * input and correct enablement.
- */
- private Listener changeListener = new Listener() {
- public void handleEvent(Event event) {
- updateValidity();
- }
- };
-
- protected Control createDialogArea(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- "org.eclipse.help.ui.prefPageHelpContent"); //$NON-NLS-1$
-
- Composite topComposite= (Composite) super.createDialogArea(parent);
- topComposite.setSize(topComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- Composite topGroup = new Composite(topComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.makeColumnsEqualWidth = false;
- topGroup.setLayout(layout);
- topGroup.setFont(topComposite.getFont());
- topGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
-
-
- // add controls to composite as necessary
- createNameSection(topGroup);
- createHostSection(topGroup);
- createPathSection(topGroup);
- createProtocolSection(topGroup);
- createPortSection(topGroup);
-
- //Initialize validator and setup for User Input
- updateValidity();
-
- Dialog.applyDialogFont(topComposite);
- return topComposite;
- }
-
- public void initializeBounds() {
- shellSize = getInitialSize();
- shellLocation = getInitialLocation(shellSize);
-
- this.getShell().setBounds(shellLocation.x, shellLocation.y,
- shellSize.x + 150, shellSize.y - 10);
- //Use exiting name implementation here
- this.getShell().setText(NLS.bind(Messages.EditICDialog_7, infoCenterName));
- }
-
- /*
- * Create the "Name:" label and text field.
- */
- private void createNameSection(Composite parent) {
- nameLabel = new Label(parent, SWT.NONE);
- nameLabel.setText(Messages.EditICDialog_10);
- nameText = new Text(parent, 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, changeListener);
- nameText.setText(selectedName);
- }
-
- /*
- * Create the "Host:" label and text field.
- */
- private void createHostSection(Composite parent) {
- hostLabel = new Label(parent, SWT.NONE);
- hostLabel.setText(Messages.EditICDialog_11);
- hostText = new Text(parent, SWT.BORDER);
- hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- if (hostText.getOrientation() == SWT.RIGHT_TO_LEFT)
- hostText.setOrientation(SWT.LEFT_TO_RIGHT);
- hostText.addListener(SWT.Modify, changeListener);
- hostText.setText(selectedHost);
- }
-
- /*
- * Create the "Path:" label and text field.
- */
- private void createPathSection(Composite parent) {
- pathLabel = new Label(parent, SWT.NONE);
- pathLabel.setText(Messages.EditICDialog_12);
- pathText = new Text(parent, SWT.BORDER);
- pathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- if (pathText.getOrientation() == SWT.RIGHT_TO_LEFT)
- pathText.setOrientation(SWT.LEFT_TO_RIGHT);
- pathText.addListener(SWT.Modify, changeListener);
- pathText.setText(selectedPath);
- }
-
- /*
- * Create the "Protocol:" label and combo box.
- */
- private void createProtocolSection(Composite parent) {
- protocolLabel = new Label(parent, SWT.NONE);
- protocolLabel.setText(Messages.EditICDialog_15);
- protocolCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
- protocolCombo.add("http"); //$NON-NLS-1$
- protocolCombo.add(PROTOCOL_HTTPS);
-
- if(selectedProtocol.equalsIgnoreCase(PROTOCOL_HTTP))
- protocolCombo.select(0);
- else if(selectedProtocol.equalsIgnoreCase(PROTOCOL_HTTPS))
- protocolCombo.select(1);
- }
-
- /*
- * Create the port radio buttons, and text field.
- */
- private void createPortSection(Composite parent) {
- Composite portComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- portComposite.setLayout(layout);
- portComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
- false, 2, 1));
-
- radio1 = new Button(portComposite, SWT.RADIO);
- radio1.setText(Messages.EditICDialog_13);
- radio1.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false,
- false, 2, 1));
- radio1.addListener(SWT.Selection, changeListener);
-
- radio2 = new Button(portComposite, SWT.RADIO);
- radio2.setText(Messages.EditICDialog_14);
-
- radio2.addListener(SWT.Selection, changeListener);
-
- portText = new Text(portComposite, SWT.BORDER);
- portText.setLayoutData(new GridData(50, SWT.DEFAULT));
- portText.addListener(SWT.Modify, changeListener);
-
- if (selectedPort.equals("80")) { //$NON-NLS-1$
- radio1.setSelection(true);
- portText.setText(""); //$NON-NLS-1$
- portText.setEnabled(false);
- } else {
- radio2.setSelection(true);
- portText.setText(selectedPort);
- portText.setEnabled(true);
- }
- }
-
- public void setTextValues(String icName, String host, String port,
- String path,String protocol) {
-
- selectedName = icName;
- selectedHost = host;
- selectedPort = port;
- selectedPath = path;
- selectedProtocol=protocol;
- }
-
- public String getEnteredHost() {
-
- return enteredHost;
- }
-
- public String getEnteredPath() {
-
- return enteredPath;
- }
-
- public String getEnteredProtocol() {
-
- return enteredProtocol;
- }
-
- public String getEnteredPort() {
-
- return enteredPort;
- }
-
- public String getEnteredName() {
- return enteredName;
- }
-
- public String getEnteredDefault() {
- return enteredUseDefault;
- }
-
- protected void okPressed() {
-
- enteredHost = hostText.getText();
- enteredName = nameText.getText();
- enteredPath = pathText.getText();
- enteredProtocol = protocolCombo.getText();
-
- //Logic here for setting port values
- if (radio1.getSelection()) //Use Default
- {
- enteredUseDefault = "true"; //$NON-NLS-1$
- enteredPort = "80"; //$NON-NLS-1$
- } else //Custom Port
- {
- enteredUseDefault = "false"; //$NON-NLS-1$
- enteredPort = portText.getText();
-
- }
- this.setReturnCode(OK);
-
- this.close();
- }
-
-
- /*
- * Checks for errors in the user input and shows/clears the error message
- * as appropriate.
- */
- private void updateValidity() {
- // no checking needed if remote not selected
- String errorMessage=""; //$NON-NLS-1$
- boolean errorFound=false;
- dialogStatus = new StatusInfo();
-
- // check for empty hostname
- if (hostText!=null && hostText.getText().equals("")) //$NON-NLS-1$
- {
- if(!errorFound)
- {
- errorMessage=Messages.AddICDialog_17;
- dialogStatus.setError(errorMessage);
- errorFound=true;
- }
-
- }
- // check for invalid port
- if (radio2!=null && radio2.getSelection() == true) {
- try {
- portText.setEnabled(true);
- // check port range
- int port = Integer.parseInt(portText.getText());
- if (port < 0 || port > 65535) {
-
- if(!errorFound)
- {
- errorMessage=Messages.AddICDialog_19;
- dialogStatus.setError(errorMessage);
- errorFound=true;
- }
-
- }
- }
- catch (NumberFormatException e) {
- // not a number
- if(!errorFound)
- {
- errorMessage=Messages.AddICDialog_19;
- dialogStatus.setError(errorMessage);
- errorFound=true;
- }
-
- }
- }
- else
- {
- if(radio1!=null && radio1.getSelection())
- {
- portText.setEnabled(false);
- }
-
- }
-
-
- if(errorFound)
- {
- this.updateStatus(dialogStatus);
- }
- else
- {
- dialogStatus.setOK();
- this.updateStatus(dialogStatus);
-
- }
- }
-}
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
deleted file mode 100644
index 9614607f6..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentBlock.java
+++ /dev/null
@@ -1,463 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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.Vector;
-
-import org.eclipse.help.internal.base.remote.RemoteIC;
-import org.eclipse.help.internal.base.util.TestConnectionUtility;
-import org.eclipse.help.ui.internal.Messages;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-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;
-
-public class HelpContentBlock {
-
- private TableViewer tableViewer;
- private Button addNewICButton;
- private Button editICButton;
- private Button removeICButton;
- 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;
- private int indexSelected;
-
- private SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Object source = e.getSource();
- if (source == addNewICButton) {
- addNewIC();
- } else if (source == editICButton) {
- editICInfo();
- } else if (source == removeICButton) {
- removeIC();
- } else if (viewPropertiesButton == source) {
- viewICProperties();
- } else if (testICConnectionButton == source) {
- testICConnection();
- } else if (enableDisableICButton == source) {
- enableDisableIC();
- } else if (upButton == source) {
- moveICUp();
- } else if (downButton == source) {
- moveICDown();
- }
- }
- };
-
- public void setContainer(IHelpContentBlockContainer container) {
- this.container = container;
- }
-
- private void addButtonsToButtonGroup(Composite parent) {
-
- addNewICButton = container.createPushButton(parent,
- Messages.HelpContentBlock_addICTitle);
- addNewICButton.addSelectionListener(selectionListener);
-
- editICButton = container.createPushButton(parent,
- Messages.HelpContentBlock_editICTitle);
- editICButton.addSelectionListener(selectionListener);
-
- removeICButton = container.createPushButton(parent,
- Messages.HelpContentBlock_removeICTitle);
- removeICButton.addSelectionListener(selectionListener);
-
- viewPropertiesButton = container.createPushButton(parent,
- Messages.HelpContentBlock_viewICTitle);
- viewPropertiesButton.addSelectionListener(selectionListener);
-
- testICConnectionButton = container
- .createPushButton(
- parent,
- Messages.HelpContentBlock_testConnectionTitle);
- testICConnectionButton.addSelectionListener(selectionListener);
-
- String enableTitle = Messages.HelpContentBlock_3.length() > Messages.HelpContentBlock_4.length() ?
- 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
- RemoteIC remoteic = (RemoteIC) ((IStructuredSelection) remoteICviewer
- .getSelection()).getFirstElement();
-
- if (remoteic != null) {
- ViewICPropsDialog dialog = new ViewICPropsDialog(remoteICviewer
- .getControl().getShell(), remoteic.getName());
-
- dialog.setTextValues(remoteic.getName(), remoteic.getHost(),
- remoteic.getPort(), remoteic.getPath(), remoteic.getProtocol(),remoteic.isEnabled());
- remoteICviewer.getTable().setSelection(indexSelected);
-
- if (dialog.open() == Window.OK) {
-
- }
- }
- }
-
- private void removeIC() {
- // Get selected item
- RemoteIC remoteic = (RemoteIC) ((IStructuredSelection) remoteICviewer
- .getSelection()).getFirstElement();
-
- boolean shouldRemove =
- MessageDialog.openQuestion(
- remoteICviewer.getControl().getShell(),
- NLS.bind(Messages.HelpContentBlock_rmvTitle , remoteic.getName()),
- NLS.bind(Messages.HelpContentBlock_rmvLabel , remoteic.getName()));
-
- if (shouldRemove)
- remoteICviewer.getRemoteICList().removeRemoteIC(remoteic);
-
-
- }
-
- private void editICInfo() {
-
- // Get selected item
- RemoteIC remoteic = (RemoteIC) ((IStructuredSelection) remoteICviewer
- .getSelection()).getFirstElement();
-
- if (remoteic != null) {
- EditICDialog dialog = new EditICDialog(remoteICviewer.getControl()
- .getShell(), remoteic.getName());
-
- dialog.setTextValues(remoteic.getName(), remoteic.getHost(),
- remoteic.getPort(), remoteic.getPath(),remoteic.getProtocol());
-
- remoteICviewer.getTable().setSelection(indexSelected);
-
- if (dialog.open() == Window.OK) {
- /*
- * Reset the values in the current RemoteIC object to the user
- * set values and update the model
- */
-
- // Check hostname for http or https, and remove
- String host = dialog.getEnteredHost();
- if (host.toLowerCase().indexOf("https://")==0) //$NON-NLS-1$
- host = host.substring(8);
- else if (host.toLowerCase().indexOf("http://")==0) //$NON-NLS-1$
- host = host.substring(7);
-
- remoteic.setName(dialog.getEnteredName());
- remoteic.setHost(host);
- remoteic.setPath(dialog.getEnteredPath());
- remoteic.setPort(dialog.getEnteredPort());
- remoteic.setProtocol(dialog.getEnteredProtocol());
-
- remoteICviewer.getRemoteICList().updateRemoteIC(remoteic);
- }
-
- }
- }
-
- private void addNewIC() {
-
- AddICDialog dialog = new AddICDialog(remoteICviewer.getControl()
- .getShell());
-
- int rowCount;
-
- if (dialog.open() == Window.OK) {
-
- // For now, remove http or https if user
- // puts it in the hostname field
- String host = dialog.getEnteredHost();
- if (host.toLowerCase().indexOf("https://")==0) //$NON-NLS-1$
- host = host.substring(8);
- else if (host.toLowerCase().indexOf("http://")==0) //$NON-NLS-1$
- host = host.substring(7);
-
- RemoteIC remoteic = new RemoteIC(true, dialog.getEnteredName(),
- host, dialog.getEnteredPath(), dialog.getEnteredProtocol(),dialog
- .getEnteredPort());
- remoteICviewer.getRemoteICList().addRemoteIC(remoteic);
- rowCount = remoteICviewer.getTable().getItemCount();
- remoteICviewer.getTable().setSelection(rowCount - 1);
- indexSelected = rowCount - 1;
-
- addNewICButton.setEnabled(true);
- removeICButton.setEnabled(true);
- editICButton.setEnabled(true);
- viewPropertiesButton.setEnabled(true);
- testICConnectionButton.setEnabled(true);
-
- enableDisableICButton.setText(Messages.HelpContentBlock_3);
- enableDisableICButton.setEnabled(true);
-
- upButton.setEnabled(true);
- downButton.setEnabled(true);
- }
-
- }
-
- // Action method for clicking the Test Connection button
-
- public void testICConnection() {
- boolean isConnected;
-
- // Get selected item
- RemoteIC remoteic = (RemoteIC) ((IStructuredSelection) remoteICviewer
- .getSelection()).getFirstElement();
-
- if (remoteic != null) {
- isConnected = TestConnectionUtility.testConnection(remoteic.getHost(),
- remoteic.getPort(), remoteic.getPath(),remoteic.getProtocol());
- TestConnectionDialog dialog = new TestConnectionDialog(
- remoteICviewer.getControl().getShell());
- dialog.setValues(remoteic.getName(), remoteic.getHost(), remoteic
- .getPort(), remoteic.getPath());
- dialog.setConnectionStatus(isConnected);
- dialog.open();
- }
-
- remoteICviewer.getTable().setSelection(indexSelected);
-
- }
-
- // Handle Enable/Disable IC
- public void enableDisableIC() {
-
- RemoteIC selectedIC = remoteICviewer.getRemoteICList()
- .getRemoteICAtIndex(indexSelected);
- boolean isEnabled = selectedIC.isEnabled();
- if (isEnabled) // New status is Enabled. Set button text
- {
- selectedIC.setEnabled(false);
- } else // New status is disabled
- {
- selectedIC.setEnabled(true);
- }
-
- remoteICviewer.getTable().setSelection(indexSelected);
- tableSelectionChanged((IStructuredSelection) remoteICviewer
- .getTableViewer().getSelection());
-
- remoteICviewer.getRemoteICList().refreshRemoteIC(selectedIC,
- indexSelected);
-
- }
-
- /**
- * 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) {
- Composite buttonGroup = new Composite(top, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttonGroup.setLayout(layout);
- buttonGroup.setLayoutData(new GridData(GridData.FILL_VERTICAL));
- buttonGroup.setFont(top.getFont());
-
- addButtonsToButtonGroup(buttonGroup);
- }
-
- private void createRemoteICTable(Composite parent) {
-
- remoteICviewer = new RemoteICViewer(parent);
- }
-
- public void createContents(Composite parent) {
- createRemoteICTable(parent);
- createButtonGroup(parent);
-
- tableSelectionChanged((IStructuredSelection) remoteICviewer
- .getTableViewer().getSelection());
- remoteICviewer.getTableViewer().addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- tableSelectionChanged((IStructuredSelection) event
- .getSelection());
- }
- });
- }
-
- private void tableSelectionChanged(IStructuredSelection selection) {
-
- indexSelected = remoteICviewer.getTable().getSelectionIndex();
-
- RemoteIC selectedEntry = (RemoteIC) ((IStructuredSelection) selection)
- .getFirstElement();
-
- if (selectedEntry != null) {
- addNewICButton.setEnabled(true);
- removeICButton.setEnabled(true);
- editICButton.setEnabled(true);
- viewPropertiesButton.setEnabled(true);
- testICConnectionButton.setEnabled(true);
-
- boolean currentEnabledStatus = selectedEntry.isEnabled();
- if (indexSelected == -1) {
- enableDisableICButton.setText(Messages.HelpContentBlock_4);
- enableDisableICButton.setEnabled(false);
- } else if (currentEnabledStatus) {
- // IC enabled. Button text is Disable
-
- enableDisableICButton.setText(Messages.HelpContentBlock_3);
- enableDisableICButton.setEnabled(true);
- selectedEntry.setEnabled(true);
- } else {
- enableDisableICButton.setText(Messages.HelpContentBlock_4);
- enableDisableICButton.setEnabled(true);
- selectedEntry.setEnabled(false);
- }
-
- upButton.setEnabled(true);
- downButton.setEnabled(true);
-
- } else {
- restoreDefaultButtons();
- }
-
- }
-
- public void updateContainer() {
- validated = 0;
- container.update();
- }
-
- public boolean isValidated() {
- return validated >= 2;
- }
-
- public void setValidated() {
- validated = 2;
- }
-
- public TableViewer getHelpBlockTableViewer() {
- return tableViewer;
- }
-
- public void restoreDefaultButtons() {
-
- addNewICButton.setEnabled(true);
- editICButton.setEnabled(false);
- removeICButton.setEnabled(false);
- viewPropertiesButton.setEnabled(false);
- testICConnectionButton.setEnabled(false);
- enableDisableICButton.setEnabled(false);
- enableDisableICButton.setText(Messages.HelpContentBlock_4);
- upButton.setEnabled(false);
- downButton.setEnabled(false);
-
- // Clear previous table selection
- indexSelected = - 1;
-
-
- }
-
- public void disableAllButtons() {
- addNewICButton.setEnabled(false);
- editICButton.setEnabled(false);
- removeICButton.setEnabled(false);
- viewPropertiesButton.setEnabled(false);
- testICConnectionButton.setEnabled(false);
- enableDisableICButton.setEnabled(false);
- enableDisableICButton.setText(Messages.HelpContentBlock_4);
- upButton.setEnabled(false);
- downButton.setEnabled(false);
- }
-
- public RemoteICViewer getRemoteICviewer()
- {
- return remoteICviewer;
- }
-
- public RemoteIC[] getRemoteICList() {
- return remoteICviewer.getRemoteICList().getRemoteICArray();
- }
-}
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
index e761b5b88..825c9e227 100644
--- 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
@@ -190,6 +190,26 @@ public class ICDialog extends StatusDialog implements IShellProvider, Listener,
this.updateStatus(status);
}
+ private boolean areFieldsValid()
+ {
+ if (nameText!=null && nameText.getText().equals("")) //$NON-NLS-1$
+ return false;
+ else if (hrefText!=null)
+ {
+ try {
+ String href = hrefText.getText();
+ new URL(href);
+
+ if (!href.matches(".*\\://.+/.+")) //$NON-NLS-1$
+ return false;
+
+ } catch (MalformedURLException e) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private void testConnection()
{
IC testIC;
@@ -210,10 +230,10 @@ public class ICDialog extends StatusDialog implements IShellProvider, Listener,
status = new Status(IStatus.WARNING,"org.eclipse.help.ui",Messages.TestConnectionDialog_13); //$NON-NLS-1$
}
-
+
updateStatus(status);
- this.getOKButton().setEnabled(true);
+ this.getOKButton().setEnabled(areFieldsValid());
this.getCancelButton().setEnabled(true);
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IHelpContentBlockContainer.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IHelpContentBlockContainer.java
deleted file mode 100644
index a4d2e0e3b..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IHelpContentBlockContainer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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 org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-public interface IHelpContentBlockContainer {
-
- /**
- * Sets the error message for the container.
- * May be <code>null</code> to remove the error message.
- *
- * @param message A string error message or <code>null</code>
- */
- public void setErrorMessage(String message);
-
- /**
- * Sets the message for the container.
- * May be <code>null</code> to remove the message.
- *
- * @param message A string message or <code>null</code>
- */
- public void setMessage(String message);
-
- /**
- * Creates and returns a properly configured push button with
- * the supplied label
- *
- * @param parent The composite parent of the button
- * @param label The button label
- *
- * @return button the created button
- */
- public Button createPushButton(Composite parent, String label);
-
- /**
- * Notifies the container that state has changed.
- */
- public void update();
-
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IRemoteHelpListViewer.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IRemoteHelpListViewer.java
deleted file mode 100644
index 25b60e0ca..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/IRemoteHelpListViewer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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 org.eclipse.help.internal.base.remote.RemoteIC;
-
-
-public interface IRemoteHelpListViewer {
-
- /**
- * Add a help entry to the model and update the view
- *
- * @param RemoteIC
- */
- public void addRemoteIC(RemoteIC remote_ic);
-
- /**
- * Remove a help entry from the model and update the view
- *
- * @param RemoteIC
- */
- public void removeRemoteIC(RemoteIC remote_ic);
-
- /**
- * Update an entry in the model
- * @param RemoteIC
- */
- public void updateRemoteIC(RemoteIC remote_ic);
-
- /**
- * Refresh an entry in the model at the specified index
- * @param RemoteIC
- */
- public void refreshRemoteIC(RemoteIC remote_ic, int selectedIndex);
-
- /**
- * Remove all entries in the model
- * @param RemoteIC
- */
- public void removeAllRemoteICs(Object [] remoteICs);
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/InfocenterDisplay.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/InfocenterDisplay.java
deleted file mode 100644
index f787cee84..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/InfocenterDisplay.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.ui.internal.preferences;
-
-import org.eclipse.help.ui.internal.IHelpUIConstants;
-import org.eclipse.jface.dialogs.Dialog;
-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.ui.PlatformUI;
-
-public class InfocenterDisplay implements IHelpContentBlockContainer {
-
- private HelpContentBlock fHelpContentBlock = new HelpContentBlock();
- private HelpContentPreferencePage fPreferencePage;
-
- /**
- * Creates an instance.
- */
- public InfocenterDisplay(HelpContentPreferencePage preferencePage) {
- fPreferencePage = preferencePage;
- }
-
- /**
- * This create the page controls
- */
- protected Composite createContents(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- IHelpUIConstants.PREF_PAGE_HELP_CONTENT);
-
- 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));
-
- fHelpContentBlock.setContainer(this);
- fHelpContentBlock.createContents(top);
- Dialog.applyDialogFont(top);
- return top;
- }
-
- public Button createPushButton(Composite parent, String buttonText) {
- Button button = new Button(parent, SWT.PUSH);
- button.setFont(parent.getFont());
- button.setText(buttonText);
- fPreferencePage.setButtonLayoutData(button);
- return button;
- }
-
- public void setErrorMessage(String message) {
-
- }
-
- public void setMessage(String message) {
-
- }
-
- public void update() {
- if (fHelpContentBlock.isValidated()) {
- return;
- }
- setMessage(null);
- setErrorMessage(null);
- fPreferencePage.setValid(true);
- }
-
- public HelpContentBlock getHelpContentBlock()
- {
- return fHelpContentBlock;
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICLabelProvider.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICLabelProvider.java
deleted file mode 100644
index bbd49831a..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICLabelProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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 org.eclipse.help.internal.base.remote.RemoteIC;
-import org.eclipse.help.ui.internal.Messages;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-
-public class RemoteICLabelProvider extends LabelProvider implements
- ITableLabelProvider {
-
- private final String PROTOCOL = "://"; //$NON-NLS-1$
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- String result = ""; //$NON-NLS-1$
- RemoteIC remoteic = (RemoteIC) element;
- switch (columnIndex) {
- case 0:
- result = remoteic.getName();
- break;
- case 1:
-
- if(remoteic.getPort().equals("80")) //$NON-NLS-1$
- {
- result = remoteic.getProtocol() + PROTOCOL + remoteic.getHost() + remoteic.getPath();
- }
- else
- {
- result = remoteic.getProtocol() + PROTOCOL + remoteic.getHost() + ":" + remoteic.getPort() //$NON-NLS-1$
- + remoteic.getPath();
- }
- break;
- case 2:
- result = (remoteic.isEnabled()) ? Messages.RemoteICLabelProvider_4 : Messages.RemoteICLabelProvider_5;
- break;
- default:
- break;
- }
- return result;
- }
-
-}
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
deleted file mode 100644
index e7b3d00b1..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICList.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.help.internal.base.remote.DefaultPreferenceFileHandler;
-import org.eclipse.help.internal.base.remote.PreferenceFileHandler;
-import org.eclipse.help.internal.base.remote.RemoteIC;
-
-
-
-/**
- * This class will initialize the model of Remote Infocenters using the values
- * from the preferences.ini file
- *
- * @author administrator
- *
- */
-public class RemoteICList {
-
- private Vector remote_ics = new Vector();
-
- private Set changeListeners = new HashSet();
-
- private PreferenceFileHandler prefsFileHandler;
-
- public RemoteICList() {
-
- loadPreferences();
-
- }
-
- private void loadPreferences() {
-
- // Load the preferences in org.eclipse.help.base/preferences.ini
- prefsFileHandler = new PreferenceFileHandler();
- int totalICs = prefsFileHandler.getTotalRemoteInfocenters();
- String host,name,path,protocol,port,enabledDisabled;
- boolean currEnabled;
-
- for (int i = 0; i < totalICs; i++) {
-
- host = (prefsFileHandler.getHostEntries())[i];
- name = (prefsFileHandler.getNameEntries())[i];
- path = (prefsFileHandler.getPathEntries())[i];
- port = (prefsFileHandler.getPortEntries())[i];
- protocol = (prefsFileHandler.getProtocolEntries())[i];
- enabledDisabled=(prefsFileHandler.getEnabledEntries())[i];
- if(enabledDisabled.equals("true")) //$NON-NLS-1$
- {
- currEnabled=true;
- }
- else
- {
- currEnabled=false;
- }
-
- // Add preferences to the model
- RemoteIC initRemoteIC;
- initRemoteIC = new RemoteIC(currEnabled, name, host, path, protocol, port);
- remote_ics.add(initRemoteIC);
- }
- }
-
- public void loadDefaultPreferences() {
-
- // Load the preferences in org.eclipse.help.base/preferences.ini
- DefaultPreferenceFileHandler handler = new DefaultPreferenceFileHandler();
- int totalICs = handler.getTotalRemoteInfocenters();
- String host,name,path,protocol,port,enabledDisabled;
- boolean currEnabled;
-
- for (int i = 0; i < totalICs; i++) {
-
- host = (handler.getHostEntries())[i];
- name = (handler.getNameEntries())[i];
- path = (handler.getPathEntries())[i];
- protocol = (handler.getProtocolEntries())[i];
- port = (handler.getPortEntries())[i];
- enabledDisabled=(handler.getEnabledEntries())[i];
- if(enabledDisabled.equals("true")) //$NON-NLS-1$
- {
- currEnabled=true;
- }
- else
- {
- currEnabled=false;
- }
-
- // Add preferences to the model
- RemoteIC initRemoteIC;
- initRemoteIC = new RemoteIC(currEnabled, name, host, path, protocol, port);
-
- addRemoteIC(initRemoteIC);
- }
- }
-
- /**
- * Return the collection of remote_ic
- */
- public Vector getRemoteICs() {
- return remote_ics;
- }
-
- /**
- * @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)
- {
- return (RemoteIC)remote_ics.get(index);
-
- }
- /**
- * Add a new remote_ic to the collection of remote_ic
- */
- public void addRemoteIC(RemoteIC remote_ic) {
- remote_ics.add(remote_ics.size(), remote_ic);
- Iterator iterator = changeListeners.iterator();
- while (iterator.hasNext())
- ((IRemoteHelpListViewer) iterator.next()).addRemoteIC(remote_ic);
- }
-
- /**
- * @param remote_ic
- */
- public void removeRemoteIC(RemoteIC remote_ic) {
- remote_ics.remove(remote_ic);
- Iterator iterator = changeListeners.iterator();
- while (iterator.hasNext())
- ((IRemoteHelpListViewer) iterator.next()).removeRemoteIC(remote_ic);
- }
-
- /**
- * @param remote_ic
- */
- public void updateRemoteIC(RemoteIC remote_ic) {
- Iterator iterator = changeListeners.iterator();
- while (iterator.hasNext())
- ((IRemoteHelpListViewer) iterator.next()).updateRemoteIC(remote_ic);
- }
-
- public void refreshRemoteIC(RemoteIC remote_ic,int selectedIndex)
- {
- remote_ics.setElementAt(remote_ic, selectedIndex);
- Iterator iterator = changeListeners.iterator();
- while (iterator.hasNext())
- ((IRemoteHelpListViewer) iterator.next()).refreshRemoteIC(remote_ic, selectedIndex);
-
-
- }
-
- public void removeAllRemoteICs(Object [] remoteICs)
- {
- remote_ics.clear();
- Iterator iterator = changeListeners.iterator();
- while (iterator.hasNext())
- ((IRemoteHelpListViewer) iterator.next()).removeAllRemoteICs(remoteICs);
- }
- /**
- * @param viewer
- */
- public void removeChangeListener(IRemoteHelpListViewer viewer) {
- changeListeners.remove(viewer);
-
- }
-
- /**
- * @param viewer
- */
- public void addChangeListener(IRemoteHelpListViewer viewer) {
- changeListeners.add(viewer);
- }
-
- public PreferenceFileHandler getPrefsReader() {
- return prefsFileHandler;
- }
-
- /**
- * Return the String [] of Remote ICs
- * @return String [] containing the latest Remote ICs in the table
- */
- public RemoteIC[] getRemoteICArray()
- {
- RemoteIC[] latestTableEntries;
-
- latestTableEntries=(RemoteIC[])remote_ics.toArray(new RemoteIC[remote_ics.size()]);
-
- return latestTableEntries;
-
- }
-}
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
deleted file mode 100644
index c940685aa..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/RemoteICViewer.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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.Arrays;
-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.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-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 RemoteICViewer {
- /**
- * @param parent
- */
- public RemoteICViewer(Composite parent) {
-
- // Create the table
- createTable(parent);
- // Create and setup the TableViewer
- createTableViewer();
- tableViewer.setContentProvider(new RemoteICContentProvider());
- tableViewer.setLabelProvider(new RemoteICLabelProvider());
- // The input for the table viewer is the instance of RemoteICList
- remoteICList = new RemoteICList();
- tableViewer.setInput(remoteICList);
-
- }
-
- private Table table;
-
- private TableViewer tableViewer;
-
- // Create a RemoteICList and assign it to an instance variable
- private RemoteICList remoteICList = new RemoteICList();
-
- // Set the table column property names
-
- 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};
-
- /**
- * Release resources
- */
- public void dispose() {
-
- // Tell the label provider to release its resources
- tableViewer.getLabelProvider().dispose();
- }
-
- /**
- * Create the Table
- */
- private void createTable(Composite parent) {
- int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.FULL_SELECTION;
-
- table = new Table(parent, style);
-
- 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);
-
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- table.setFont(parent.getFont());
-
- 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);
- }
-
- /**
- * Create the TableViewer
- */
- private void createTableViewer() {
-
- tableViewer = new TableViewer(table);
- tableViewer.setUseHashlookup(true);
- tableViewer.setColumnProperties(columnNames);
-
- }
-
- /**
- * Proxy for the the RemoteICList which provides content
- * for the Table. This class implements IRemoteHelpListViewer interface an
- * registers itself with RemoteICList
- */
- class RemoteICContentProvider implements IStructuredContentProvider,
- IRemoteHelpListViewer {
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- if (newInput != null)
- ((RemoteICList) newInput).addChangeListener(this);
- if (oldInput != null)
- ((RemoteICList) oldInput).removeChangeListener(this);
- }
-
- public void dispose() {
- remoteICList.removeChangeListener(this);
- }
-
- // Return the remote ICs as an array of Objects
- public Object[] getElements(Object parent) {
- return remoteICList.getRemoteICs().toArray();
- }
-
- public void addRemoteIC(RemoteIC remoteic) {
- tableViewer.add(remoteic);
- }
-
- public void removeRemoteIC(RemoteIC remoteic) {
- tableViewer.remove(remoteic);
- }
-
- public void updateRemoteIC(RemoteIC remoteic) {
- tableViewer.update(remoteic, null);
-
- }
- public void refreshRemoteIC(RemoteIC remoteic, int selectedIndex) {
- tableViewer.replace(remoteic, selectedIndex);
-
- }
- public void removeAllRemoteICs(Object [] remoteICs)
- {
- tableViewer.remove(remoteICs);
-
- }
- }
-
- /**
- * @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
- */
- public java.util.List getColumnNames() {
- return Arrays.asList(columnNames);
- }
-
- /**
- * @return currently selected item
- */
- public ISelection getSelection() {
- return tableViewer.getSelection();
- }
-
- /**
- * Return the RemoteICList
- */
- public RemoteICList getRemoteICList() {
- return remoteICList;
- }
-
- public TableViewer getTableViewer()
- {
- return tableViewer;
- }
- /**
- * Return the parent composite
- */
- public Control getControl() {
- return table.getParent();
- }
-
- public Table getTable() {
- return table;
- }
-
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/StatusInfo.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/StatusInfo.java
deleted file mode 100644
index b2a77e414..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/StatusInfo.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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 org.eclipse.help.ui.internal.IHelpUIConstants;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * A settable IStatus.
- * Can be an error, warning, info or ok. For error, info and warning states,
- * a message describes the problem.
- *
- * Controls the error messages displayed on the Add, Edit dialogs
- */
-public class StatusInfo implements IStatus {
-
- private String fStatusMessage;
- private int fSeverity;
-
- /**
- * Creates a status set to OK (no message)
- */
- public StatusInfo() {
- this(OK, null);
- }
-
- /**
- * Creates a status .
- * @param severity The status severity: ERROR, WARNING, INFO and OK.
- * @param message The message of the status. Applies only for ERROR,
- * WARNING and INFO.
- */
- public StatusInfo(int severity, String message) {
- fStatusMessage= message;
- fSeverity= severity;
- }
-
- /**
- * Returns if the status' severity is OK.
- */
- public boolean isOK() {
- return fSeverity == IStatus.OK;
- }
-
- /**
- * Returns if the status' severity is WARNING.
- */
- public boolean isWarning() {
- return fSeverity == IStatus.WARNING;
- }
-
- /**
- * Returns if the status' severity is INFO.
- */
- public boolean isInfo() {
- return fSeverity == IStatus.INFO;
- }
-
- /**
- * Returns if the status' severity is ERROR.
- */
- public boolean isError() {
- return fSeverity == IStatus.ERROR;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IStatus#getMessage()
- */
- public String getMessage() {
- return fStatusMessage;
- }
-
- /**
- * Sets the status to ERROR.
- * @param errorMessage The error message (can be empty, but not null)
- */
- public void setError(String errorMessage) {
- Assert.isNotNull(errorMessage);
- fStatusMessage= errorMessage;
- fSeverity= IStatus.ERROR;
- }
-
- /**
- * Sets the status to WARNING.
- * @param warningMessage The warning message (can be empty, but not null)
- */
- public void setWarning(String warningMessage) {
- Assert.isNotNull(warningMessage);
- fStatusMessage= warningMessage;
- fSeverity= IStatus.WARNING;
- }
-
- /**
- * Sets the status to INFO.
- * @param infoMessage The info message (can be empty, but not null)
- */
- public void setInfo(String infoMessage) {
- Assert.isNotNull(infoMessage);
- fStatusMessage= infoMessage;
- fSeverity= IStatus.INFO;
- }
-
- /**
- * Sets the status to OK.
- */
- public void setOK() {
- fStatusMessage= null;
- fSeverity= IStatus.OK;
- }
-
- /*
- * @see IStatus#matches(int)
- */
- public boolean matches(int severityMask) {
- return (fSeverity & severityMask) != 0;
- }
-
- /**
- * Returns always <code>false</code>.
- * @see IStatus#isMultiStatus()
- */
- public boolean isMultiStatus() {
- return false;
- }
-
- /*
- * @see IStatus#getSeverity()
- */
- public int getSeverity() {
- return fSeverity;
- }
-
- /*
- * @see IStatus#getPlugin()
- */
- public String getPlugin() {
- return IHelpUIConstants.HELP_UI_PLUGIN_ID;
- }
-
- /**
- * Returns always <code>null</code>.
- * @see IStatus#getException()
- */
- public Throwable getException() {
- return null;
- }
-
- /**
- * Returns always the error severity.
- * @see IStatus#getCode()
- */
- public int getCode() {
- return fSeverity;
- }
-
- /**
- * Returns always <code>null</code>.
- * @see IStatus#getChildren()
- */
- public IStatus[] getChildren() {
- return new IStatus[0];
- }
-
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/TestConnectionDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/TestConnectionDialog.java
deleted file mode 100644
index 2a4ab1e99..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/TestConnectionDialog.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.ui.internal.preferences;
-
-import org.eclipse.help.ui.internal.Messages;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.StatusDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-public class TestConnectionDialog extends StatusDialog implements IShellProvider {
-
- private Label testConnectionLabel;
- private Label urlLabel;
-
- Point shellSize;
- Point shellLocation;
- private String infoCenterName = "", infoCenterHost = "", //$NON-NLS-1$ //$NON-NLS-2$
- infoCenterPath = "", infoCenterPort = ""; //$NON-NLS-1$ //$NON-NLS-2$
-
- boolean successfullConnection = false;
- Color connectionColor;
-
- protected TestConnectionDialog(Shell parentShell) {
-
- super(parentShell);
- // TODO Auto-generated constructor stub
- }
-
- protected Control createDialogArea(Composite parent) {
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- // IHelpUIConstants.PREF_PAGE_HELP_CONTENT);
-
- setHelpAvailable(false);
-
- Composite topComposite= (Composite) super.createDialogArea(parent);
- topComposite.setSize(topComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- Composite topGroup = new Composite(topComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.makeColumnsEqualWidth = false;
- topGroup.setLayout(layout);
- topGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- createTestLabelSection(topGroup);
- createURLSection(topGroup);
- Dialog.applyDialogFont(topGroup);
-
- return topGroup;
- }
-
-
- /*
- * Override createButtonsForButtonBar to have only one button (OK)
- */
-
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK button only by default
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- }
-
- public void initializeBounds() {
- shellSize = getInitialSize();
- shellLocation = getInitialLocation(shellSize);
- this.getShell().setBounds(shellLocation.x, shellLocation.y,
- shellSize.x + 150, shellSize.y);
- this.getShell().setText(
- Messages.TestConnectionDialog_4);
- }
-
- /*
- * Create the "Connection" label.
- */
- private void createTestLabelSection(Composite parent) {
- testConnectionLabel = new Label(parent, SWT.VERTICAL);
-
- testConnectionLabel.setText(NLS.bind(Messages.TestConnectionDialog_6 ,infoCenterName));
- }
-
- /*
- * Create the "URL" label.
- */
- private void createURLSection(Composite parent) {
- urlLabel = new Label(parent, SWT.VERTICAL);
-
- String urlTemplate = Messages.TestConnectionDialog_URL_With_Param;
- String urlString="http://" + infoCenterHost; //$NON-NLS-1$
- if (infoCenterPort
- .equals("80")) { //$NON-NLS-1$
- urlString = urlString + infoCenterPath;
-
- } else {
- urlString = urlString + ":" + infoCenterPort + infoCenterPath; //$NON-NLS-1$
- }
- urlString = NLS.bind(urlTemplate, urlString);
- urlLabel.setText("\n" + urlString + '\n'); //$NON-NLS-1$
- }
-
- //Override cancel button so it acts as OK. Then set OK button not visible, because we only need one button
- public void cancelPressed()
- {
- this.setReturnCode(OK);
-
- if (connectionColor != null) {
- connectionColor.dispose();
- }
- this.close();
- }
- public void setValues(String icName, String icHost, String icPort,
- String icPath) {
- infoCenterName = icName;
- infoCenterHost = icHost;
- infoCenterPath = icPath;
- infoCenterPort = icPort;
- }
-
-
-
- public void create() {
- // TODO Auto-generated method stub
- super.create();
- setConnectionStatus(successfullConnection);
- }
-
- public void setConnectionStatus(boolean testStatus) {
- successfullConnection = testStatus;
- StatusInfo status = new StatusInfo();
-
- if(successfullConnection)
- status.setInfo(Messages.TestConnectionDialog_12);
- else
- status.setError(Messages.TestConnectionDialog_13);
-
- updateStatus(status);
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ViewICPropsDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ViewICPropsDialog.java
deleted file mode 100644
index 0e9f7a49b..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ViewICPropsDialog.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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 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.StatusDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-
-public class ViewICPropsDialog extends StatusDialog implements IShellProvider {
-
- private Label nameLabel;
-
- private Label nameText;
-
- private Label hostLabel;
-
- private Label hostText;
-
- private Label pathLabel;
-
- private Label pathText;
-
- private Label protocolLabel;
-
- private Label protocolText;
-
- private Label portLabel;
-
- private Label portText;
-
- private Label urlLabel;
-
- private Label urlValue;
-
- private Label enabledLabel;
-
- private Label enabledValue;
-
- Point shellSize;
-
- Point shellLocation;
-
- private String infoCenterName = ""; //$NON-NLS-1$
-
- private String selectedName = ""; //$NON-NLS-1$
-
- private String selectedHost = ""; //$NON-NLS-1$
-
- private String selectedPort = ""; //$NON-NLS-1$
-
- private String selectedPath = ""; //$NON-NLS-1$
-
- private String selectedProtocol = ""; //$NON-NLS-1$
-
- private boolean selectedEnabled;
-
- public ViewICPropsDialog(Shell parentShell, String infoCenterName) {
-
- super(parentShell);
- this.infoCenterName = infoCenterName;
- }
-
- protected Control createDialogArea(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- "org.eclipse.help.ui.prefPageHelpContent"); //$NON-NLS-1$
-
-
-
- Composite topComposite= (Composite) super.createDialogArea(parent);
- topComposite.setSize(topComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- Composite topGroup = new Composite(topComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.makeColumnsEqualWidth = false;
- topGroup.setLayout(layout);
- topGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
-
- // add controls to composite as necessary
- createNameSection(topGroup);
- createHostSection(topGroup);
- createPathSection(topGroup);
- createProtocolSection(topGroup);
- createPortSection(topGroup);
- createURLValidateSection(topGroup);
- createEnabledSection(topGroup);
-
- Dialog.applyDialogFont(topComposite);
- return topComposite;
-
- }
-
- /*
- * Override createButtonsForButtonBar to allow for:
- * TestConnection (was OK)
- * Close (was Cancel)
- */
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButton(
- parent,IDialogConstants.OK_ID,Messages.ViewICPropsDialog_6,true);
- super.createButton(
- parent,IDialogConstants.CANCEL_ID,Messages.ViewICPropsDialog_7,false);
- }
-
- public void initializeBounds() {
- shellSize = getInitialSize();
- shellLocation = getInitialLocation(shellSize);
-
- this.getShell().setBounds(shellLocation.x, shellLocation.y,
- shellSize.x +150, shellSize.y);
- this.getShell().setText(NLS.bind(Messages.ViewICPropsDialog_8 ,infoCenterName));
- }
-
- /*
- * Create the "Name:" label and text field.
- */
- private void createNameSection(Composite parent) {
- nameLabel = new Label(parent, SWT.NONE);
- nameLabel.setText(Messages.ViewICPropsDialog_10);
- nameText = new Label(parent, SWT.NONE);
- nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- nameText.setText(selectedName);
- }
-
- /*
- * Create the "Host:" label and text field.
- */
- private void createHostSection(Composite parent) {
- hostLabel = new Label(parent, SWT.NONE);
- hostLabel.setText(Messages.ViewICPropsDialog_11);
- hostText = new Label(parent, SWT.NONE);
- hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- hostText.setText(selectedHost);
- }
-
- /*
- * Create the "Path:" label and text field.
- */
- private void createPathSection(Composite parent) {
- pathLabel = new Label(parent, SWT.NONE);
- pathLabel.setText(Messages.ViewICPropsDialog_12);
- pathText = new Label(parent, SWT.NONE);
- pathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- pathText.setText(selectedPath);
-
- }
-
- /*
- * Create the "Protocol:" label and text field.
- */
- private void createProtocolSection(Composite parent) {
- protocolLabel = new Label(parent, SWT.NONE);
- protocolLabel.setText(Messages.ViewICPropsDialog_14);
- protocolText = new Label(parent, SWT.NONE);
- protocolText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- protocolText.setText(selectedProtocol);
-
- }
-
- /*
- * Create the port radio buttons, and text field.
- */
- private void createPortSection(Composite parent) {
- portLabel = new Label(parent, SWT.NONE);
- portLabel.setText(Messages.ViewICPropsDialog_13);
- portText = new Label(parent, SWT.NONE);
- portText.setText(selectedPort);
- }
-
- private void createURLValidateSection(Composite parent) {
- urlLabel = new Label(parent, SWT.NONE);
- urlLabel.setText(Messages.ViewICPropsDialog_URL);
- urlValue = new Label(parent, SWT.NONE);
- if(selectedPort.equals("80")) //$NON-NLS-1$
- {
- urlValue.setText(selectedProtocol+"://"+selectedHost + selectedPath); //$NON-NLS-1$
- }
- else
- {
- urlValue.setText(selectedProtocol+"://"+selectedHost + ":" + selectedPort + selectedPath); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- }
-
- private void createEnabledSection(Composite parent) {
- enabledLabel = new Label(parent, SWT.NONE);
- enabledLabel.setText(Messages.ViewICPropsDialog_19);
- enabledValue = new Label(parent, SWT.NONE);
-
- if (selectedEnabled) {
- enabledValue.setText(Messages.ViewICPropsDialog_20);
- } else {
- enabledValue.setText(Messages.ViewICPropsDialog_21);
- }
-
- }
-
- public void setTextValues(String icName, String host, String port,
- String path, String protocol, boolean isEnabled) {
-
- selectedName = icName;
- selectedHost = host;
- selectedPort = port;
- selectedPath = path;
- selectedProtocol = protocol;
- selectedEnabled = isEnabled;
-
-
- }
-
- public void okPressed() {
-
- StatusInfo status = new StatusInfo();
-
- // Check to see if connection is valid
- boolean isConnection = TestConnectionUtility.testConnection(selectedHost,
- selectedPort, selectedPath, selectedProtocol);
-
- if(isConnection)
- status.setInfo(Messages.ViewICPropsDialog_23);
- else
- status.setError(Messages.ViewICPropsDialog_24);
-
- updateStatus(status);
- }
-
- public void cancelPressed() {
-
- //Cancel is now OK button since right button is set to OK
-
- this.setReturnCode(OK);
-
- //Close window
- this.close();
- }
-}

Back to the top