mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 07:35:24 +02:00
[fix] [175153], [175316] and other minor bugs
This commit is contained in:
parent
4ca7fc898f
commit
2f4f34b5b1
14 changed files with 988 additions and 1343 deletions
File diff suppressed because it is too large
Load diff
|
@ -18,9 +18,9 @@ package org.eclipse.rse.ui.actions;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.wizard.IWizard;
|
||||
import org.eclipse.jface.wizard.WizardDialog;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
|
@ -48,7 +48,13 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction {
|
|||
private boolean fromPopupMenu = true;
|
||||
private ISelectionProvider sp;
|
||||
private String[] restrictSystemTypesTo;
|
||||
private IHost selectedContext;
|
||||
|
||||
// The current selection the action is knowing of. Just pass on
|
||||
// to the wizards. Do not interpret here!
|
||||
private ISelection selectedContext;
|
||||
// The associated connection object of the selected context if
|
||||
// determinable from the selected context
|
||||
private IHost connectionContext;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -104,12 +110,19 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction {
|
|||
* Our default implementation is to return <code>RSEMainNewConnectionWizard</code>.
|
||||
*/
|
||||
protected IWizard createWizard() {
|
||||
// create the new connection wizard instance.
|
||||
RSEMainNewConnectionWizard newConnWizard = new RSEMainNewConnectionWizard();
|
||||
if (!fromPopupMenu && sp != null) {
|
||||
setSelection(sp.getSelection());
|
||||
}
|
||||
|
||||
// simulate a selection changed event if the action is not called from
|
||||
// a popup menu and a selection provider is set
|
||||
if (!fromPopupMenu && sp != null) setSelection(sp.getSelection());
|
||||
|
||||
// First, restrict the wizard in the system types to show if this is
|
||||
// requested.
|
||||
if (restrictSystemTypesTo != null) {
|
||||
// Till now, we get the list of system types to restrict to via system
|
||||
// type name. This should be changed to be a list of system type objects
|
||||
// as soon as possible. Till than, we have to translate the lists here.
|
||||
List systemTypes = new LinkedList();
|
||||
for (int i = 0; i < restrictSystemTypesTo.length; i++) {
|
||||
IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(restrictSystemTypesTo[i]);
|
||||
|
@ -119,14 +132,18 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction {
|
|||
newConnWizard.restrictToSystemTypes((IRSESystemType[])systemTypes.toArray(new IRSESystemType[systemTypes.size()]));
|
||||
}
|
||||
|
||||
// if there is a system type available from the current context, this system type
|
||||
// is selected by default
|
||||
if (selectedContext != null){
|
||||
// send a selection changed event to the wizard with the selected context.
|
||||
newConnWizard.setSelection(new StructuredSelection(selectedContext));
|
||||
}
|
||||
// If there is an remembered selection, we pass on the selected context
|
||||
// totally untranslated to the wizards. The specific wizards have to
|
||||
// interpret the selection themself. We simple cannot know here what is
|
||||
// necessary and what not. Wizard providers may want to get selections
|
||||
// we have no idea from. Only chance to do so, pass the selection on.
|
||||
newConnWizard.setSelectedContext(selectedContext);
|
||||
|
||||
return newConnWizard;
|
||||
// if we had determined the connection context of the selected context, pass
|
||||
// on as well to the new connection wizard.
|
||||
newConnWizard.setConnectionContext(connectionContext);
|
||||
|
||||
return newConnWizard.isRestrictedToSingleSystemType() ? newConnWizard.getSelectedWizard() : newConnWizard;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -175,12 +192,17 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction {
|
|||
this.restrictSystemTypesTo = systemTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of parent method so we can deduce currently selected connection (direct or indirect if child object selected).
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
|
||||
*/
|
||||
public boolean updateSelection(IStructuredSelection selection) {
|
||||
boolean enable = super.updateSelection(selection);
|
||||
if (enable) {
|
||||
boolean enabled = super.updateSelection(selection);
|
||||
// store the selection. The wizard contributor may want to analyse
|
||||
// the current selection by themself.
|
||||
selectedContext = selection;
|
||||
|
||||
// and try to determine the connection context from the selection
|
||||
if (enabled) {
|
||||
Object firstSelection = getFirstSelection();
|
||||
IHost conn = null;
|
||||
if (firstSelection != null) {
|
||||
|
@ -202,9 +224,10 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction {
|
|||
conn = ss.getHost();
|
||||
}
|
||||
}
|
||||
|
||||
selectedContext = conn;
|
||||
|
||||
connectionContext = conn;
|
||||
}
|
||||
return enable;
|
||||
|
||||
return enabled;
|
||||
}
|
||||
}
|
|
@ -1,392 +0,0 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2002, 2006 IBM Corporation. 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
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.messages;
|
||||
|
||||
import org.eclipse.jface.dialogs.DialogPage;
|
||||
import org.eclipse.jface.dialogs.IMessageProvider;
|
||||
import org.eclipse.jface.wizard.WizardPage;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemResources;
|
||||
import org.eclipse.swt.custom.CLabel;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.ui.dialogs.PropertyPage;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* <p>DO NOT USE THIS CLASS!
|
||||
* <p>This class attempts to wrap the message constructs of eclipse provided property
|
||||
* and wizard pages with an ISystemMessageLine interface.
|
||||
* It fails to do this properly and is extremely fragile since it depends on knowledge
|
||||
* of the internal structure of eclipse provided windows.
|
||||
* <p>Use SystemMessageLine instead.
|
||||
*
|
||||
*/
|
||||
public class SystemDialogPageMessageLine implements ISystemMessageLine, MouseListener {
|
||||
// cached inputs
|
||||
private Label msgTextLabel;
|
||||
private Label msgIconLabel;
|
||||
private CLabel msgIconCLabel;
|
||||
private DialogPage dlgPage;
|
||||
// state
|
||||
private SystemMessage sysErrorMessage;
|
||||
private SystemMessage sysMessage;
|
||||
private boolean stringErrorMessageShowing = false;
|
||||
|
||||
/**
|
||||
* Factory method for wizard pages.
|
||||
* We only need to configure a single message line for all pages in a given wizard,
|
||||
* so this method looks after ensuring there is only one such message line created.
|
||||
* @param wizardPage - the wizard page we are configuring
|
||||
*/
|
||||
public static SystemDialogPageMessageLine createWizardMsgLine(WizardPage wizardPage) {
|
||||
SystemDialogPageMessageLine msgLine = null;
|
||||
Composite pageContainer = wizardPage.getControl().getParent();
|
||||
Object pageContainerData = null;
|
||||
|
||||
// FIXME why does this need to be commented out?
|
||||
//Object pageContainerData = pageContainer.getData();
|
||||
//System.out.println("pageContainerData = " + pageContainerData);
|
||||
if (pageContainerData == null) {
|
||||
// wizardPage.getControl() => returns the composite we created in createControl
|
||||
// .getParent() => returns the page container composite created in createPageContainer in WizardDialog, that holds all pages
|
||||
// .getParent() => returns the composite created in createDialogArea in TitleAreaDialog. The "dialog area" of the dialog below the top stuff, and above the button bar.
|
||||
// .getParent() => returns the workarea composite created in createContents in TitleAreaDialog
|
||||
// .getParent() => returns the parent composite passed to createContents in TitleAreaDialog
|
||||
// .getChildren() => returns the children of this composite, which includes the stuff at the top, which is placed
|
||||
// there by createTitleArea() in TitleAreaDialog, the parent of WizardDialog
|
||||
// [0]=> dialog image Label
|
||||
// [1]=> title Label
|
||||
// [2]=> message image Label
|
||||
// [3]=> message Label
|
||||
// [4]=> filler Label
|
||||
Composite dialogAreaComposite = pageContainer.getParent(); // see createDialogArea in WizardDialog
|
||||
Composite workAreaComposite = dialogAreaComposite.getParent(); // see createContents in TitleAreaDialog
|
||||
Composite mainComposite = workAreaComposite.getParent(); // whatever is passed into createContents in TitleAreaDialog
|
||||
Control[] list = mainComposite.getChildren();
|
||||
Label msgImageLabel = null;
|
||||
Label msgLabel = null;
|
||||
if (list[2] instanceof Label) {
|
||||
msgImageLabel = (Label) list[2];
|
||||
}
|
||||
if (list[3] instanceof Label) {
|
||||
msgLabel = (Label) list[3];
|
||||
} else if (list[4] instanceof Label) {
|
||||
msgLabel = (Label) list[4];
|
||||
}
|
||||
msgLine = new SystemDialogPageMessageLine(wizardPage, msgImageLabel, msgLabel);
|
||||
pageContainer.setData(msgLine);
|
||||
} else
|
||||
msgLine = (SystemDialogPageMessageLine) pageContainerData;
|
||||
return msgLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for property pages.
|
||||
* We only need to configure a single message line for all pages in a properties dialog,
|
||||
* so this method looks after ensuring there is only one such message line created.
|
||||
* @param propertyPage - the property page we are configuring
|
||||
*/
|
||||
public static SystemDialogPageMessageLine createPropertyPageMsgLine(PropertyPage propertyPage) {
|
||||
SystemDialogPageMessageLine msgLine = null;
|
||||
Composite pageContainer = propertyPage.getControl().getParent();
|
||||
// propertyPage.getControl() => returns the composite we created in createControl
|
||||
// .getParent() => returns the page container composite created in createPageContainer in PreferencesDialog, that holds all pages
|
||||
// .getParent() => returns the composite created in createDialogArea in PreferencesDialog. This holds the tree, title area composite, page container composite and separator
|
||||
// .getChildren()[1] => returns the title area parent composite, created in createDialogArea in PreferencesDialog
|
||||
// .getChildren()[0] => returns the title area composite, created in createTitleArea in PreferencesDialog
|
||||
// .getChildren() => returns the children of the title area composite
|
||||
// [0]=> message CLabel
|
||||
// [1]=> title image
|
||||
Composite dialogAreaComposite = pageContainer.getParent(); // see createDialogArea in PreferencesDialog
|
||||
Composite titleAreaParentComposite = (Composite) dialogAreaComposite.getChildren()[1];
|
||||
Composite titleAreaComposite = (Composite) titleAreaParentComposite.getChildren()[0];
|
||||
//Control[] list=titleAreaComposite.getChildren();
|
||||
// DKM - trying to figure out this mess for 3.0
|
||||
Composite listContainer = (Composite) titleAreaComposite.getChildren()[0];
|
||||
Control[] list = listContainer.getChildren();
|
||||
Label label1 = null;
|
||||
Label label2 = null;
|
||||
if (list.length > 0) {
|
||||
label1 = (Label) list[0];
|
||||
label2 = (Label) list[1];
|
||||
}
|
||||
msgLine = new SystemDialogPageMessageLine(propertyPage, /*(CLabel)list[0]*/label1, label2);
|
||||
pageContainer.setData(msgLine);
|
||||
return msgLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
*/
|
||||
private SystemDialogPageMessageLine(DialogPage dialogPage, Label msgIconLabel, Label msgTextLabel) {
|
||||
this.msgIconLabel = msgIconLabel;
|
||||
this.msgTextLabel = msgTextLabel;
|
||||
this.dlgPage = dialogPage;
|
||||
msgIconLabel.addMouseListener(this);
|
||||
msgTextLabel.addMouseListener(this);
|
||||
}
|
||||
|
||||
protected SystemMessage getSysErrorMessage() {
|
||||
return sysErrorMessage;
|
||||
}
|
||||
|
||||
protected SystemMessage getSysMessage() {
|
||||
return sysMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently displayed error text.
|
||||
* @return The error message. If no error message is displayed <code>null</code> is returned.
|
||||
*/
|
||||
public SystemMessage getSystemErrorMessage() {
|
||||
return sysErrorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the currently displayed error message and redisplayes
|
||||
* the message which was active before the error message was set.
|
||||
*/
|
||||
public void clearErrorMessage() {
|
||||
sysErrorMessage = null;
|
||||
stringErrorMessageShowing = false;
|
||||
dlgPage.setErrorMessage(null);
|
||||
setIconToolTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the currently displayed non-error message.
|
||||
*/
|
||||
public void clearMessage() {
|
||||
dlgPage.setMessage(null);
|
||||
sysMessage = null;
|
||||
setIconToolTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently displayed error text.
|
||||
* @return The error message. If no error message is displayed <code>null</code> is returned.
|
||||
*/
|
||||
public String getErrorMessage() {
|
||||
return dlgPage.getErrorMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently displayed message.
|
||||
* @return The message. If no message is displayed <code>null<code> is returned.
|
||||
*/
|
||||
public String getMessage() {
|
||||
return dlgPage.getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT CALL THIS METHOD! IT IS ONLY HERE BECAUSE THE INTERFACE NEEDS IT.
|
||||
* RATHER, CALL THE SAME MSG THAT DIALOGPAGE NOW SUPPORTS, AND THEN CALL
|
||||
* setInternalErrorMessage HERE. WE HAVE TO AVOID INFINITE LOOPS.
|
||||
*/
|
||||
public void setErrorMessage(String emessage) {
|
||||
internalSetErrorMessage(emessage);
|
||||
//dlgPage.setErrorMessage(emessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the given error message. A currently displayed message
|
||||
* is saved and will be redisplayed when the error message is cleared.
|
||||
*/
|
||||
public void setErrorMessage(SystemMessage emessage) {
|
||||
// I removed @deprecated... I think it was a mistake! What would be the replacement? Phil
|
||||
if (emessage == null)
|
||||
clearErrorMessage();
|
||||
else {
|
||||
dlgPage.setErrorMessage(getMessageText(emessage));
|
||||
stringErrorMessageShowing = false;
|
||||
sysErrorMessage = emessage;
|
||||
logMessage(emessage);
|
||||
}
|
||||
setIconToolTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to set an error message from an exception
|
||||
*/
|
||||
public void setErrorMessage(Throwable exc) {
|
||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
|
||||
msg.makeSubstitution(exc);
|
||||
setErrorMessage(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT CALL THIS METHOD! IT IS ONLY HERE BECAUSE THE INTERFACE NEEDS IT.
|
||||
* RATHER, CALL THE SAME MSG THAT DIALOGPAGE NOW SUPPORTS, AND THEN CALL
|
||||
* setInternalMessage HERE. WE HAVE TO AVOID INFINITE LOOPS.
|
||||
*/
|
||||
public void setMessage(String msg) {
|
||||
internalSetMessage(msg);
|
||||
dlgPage.setMessage(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a non-error message to display.
|
||||
* If the message line currently displays an error,
|
||||
* the message is stored and will be shown after a call to clearErrorMessage
|
||||
*/
|
||||
public void setMessage(SystemMessage smessage) {
|
||||
if (smessage == null) {
|
||||
clearMessage(); // phil
|
||||
return;
|
||||
}
|
||||
sysMessage = smessage;
|
||||
int msgType = IMessageProvider.NONE;
|
||||
if ((smessage.getIndicator() == SystemMessage.ERROR) || (smessage.getIndicator() == SystemMessage.UNEXPECTED))
|
||||
msgType = IMessageProvider.ERROR;
|
||||
else if (smessage.getIndicator() == SystemMessage.WARNING)
|
||||
msgType = IMessageProvider.WARNING;
|
||||
else if (smessage.getIndicator() == SystemMessage.INFORMATION || (smessage.getIndicator() == SystemMessage.COMPLETION)) msgType = IMessageProvider.INFORMATION;
|
||||
dlgPage.setMessage(getMessageText(smessage), msgType);
|
||||
logMessage(smessage);
|
||||
setIconToolTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* logs the message in the appropriate log
|
||||
*/
|
||||
private void logMessage(SystemMessage message) {
|
||||
Object[] subList = message.getSubVariables();
|
||||
for (int i = 0; subList != null && i < subList.length; i++) {
|
||||
String msg = message.getFullMessageID() + ": SUB#" + new Integer(i).toString() + ":" + message.getSubValue(subList[i]); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (message.getIndicator() == SystemMessage.INFORMATION || message.getIndicator() == SystemMessage.INQUIRY || message.getIndicator() == SystemMessage.COMPLETION)
|
||||
SystemBasePlugin.logInfo(msg);
|
||||
else if (message.getIndicator() == SystemMessage.WARNING)
|
||||
SystemBasePlugin.logWarning(msg);
|
||||
else if (message.getIndicator() == SystemMessage.ERROR)
|
||||
SystemBasePlugin.logError(msg, null);
|
||||
else if (message.getIndicator() == SystemMessage.UNEXPECTED) {
|
||||
if (i == subList.length - 1)
|
||||
SystemBasePlugin.logError(msg, new Exception());
|
||||
else
|
||||
SystemBasePlugin.logError(msg, null);
|
||||
}
|
||||
}
|
||||
if (subList == null) {
|
||||
String msg = message.getFullMessageID();
|
||||
if (message.getIndicator() == SystemMessage.INFORMATION || message.getIndicator() == SystemMessage.INQUIRY || message.getIndicator() == SystemMessage.COMPLETION)
|
||||
SystemBasePlugin.logInfo(msg);
|
||||
else if (message.getIndicator() == SystemMessage.WARNING)
|
||||
SystemBasePlugin.logWarning(msg);
|
||||
else if (message.getIndicator() == SystemMessage.ERROR)
|
||||
SystemBasePlugin.logError(msg, null);
|
||||
else if (message.getIndicator() == SystemMessage.UNEXPECTED) SystemBasePlugin.logError(msg, new Exception());
|
||||
}
|
||||
}
|
||||
|
||||
// METHODS THAT NEED TO BE CALLED BY DIALOGPAGE IN THEIR OVERRIDE OF SETMESSAGE OR SETERRORMESSAGE
|
||||
/**
|
||||
* Someone has called setMessage(String) on the dialog page. It needs to then call this method
|
||||
* after calling super.setMessage(String) so we can keep track of what is happening.
|
||||
*/
|
||||
public void internalSetMessage(String msg) {
|
||||
sysMessage = null; // overrides it if it was set
|
||||
setIconToolTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Someone has called setErrorMessage(String) on the dialog page. It needs to then call this method
|
||||
* after calling super.setErrorMessage(String) so we can keep track of what is happening.
|
||||
*/
|
||||
public void internalSetErrorMessage(String msg) {
|
||||
sysErrorMessage = null; // overrides if it was set
|
||||
stringErrorMessageShowing = (msg != null);
|
||||
setIconToolTipText();
|
||||
}
|
||||
|
||||
// MOUSeListener INTERFACE METHODS...
|
||||
/**
|
||||
* User double clicked with the mouse
|
||||
*/
|
||||
public void mouseDoubleClick(MouseEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* User pressed the mouse button
|
||||
*/
|
||||
public void mouseDown(MouseEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* User released the mouse button after pressing it
|
||||
*/
|
||||
public void mouseUp(MouseEvent event) {
|
||||
displayMessageDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the current system message to display. If error message is set, return it,
|
||||
* else return message.
|
||||
*/
|
||||
public SystemMessage getCurrentMessage() {
|
||||
if (sysErrorMessage != null)
|
||||
return sysErrorMessage;
|
||||
else if (!stringErrorMessageShowing)
|
||||
return sysMessage;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to display an error message when the msg button is clicked
|
||||
*/
|
||||
private void displayMessageDialog() {
|
||||
SystemMessage currentMessage = getCurrentMessage();
|
||||
if (currentMessage != null) {
|
||||
SystemMessageDialog msgDlg = new SystemMessageDialog(dlgPage.getShell(), currentMessage);
|
||||
msgDlg.openWithDetails();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the tooltip text on the msg icon to tell the user they can press it for more details
|
||||
*/
|
||||
private void setIconToolTipText() {
|
||||
SystemMessage msg = getCurrentMessage();
|
||||
String tip = ""; //$NON-NLS-1$
|
||||
if (msg != null) {
|
||||
//String levelTwo = msg.getLevelTwoText();
|
||||
//if ((levelTwo!=null) && (levelTwo.length()>0))
|
||||
tip = msg.getFullMessageID() + " " + SystemResources.RESID_MSGLINE_TIP; //$NON-NLS-1$
|
||||
}
|
||||
if (msgIconLabel != null) msgIconLabel.setToolTipText(tip);
|
||||
if (msgTextLabel != null)
|
||||
msgTextLabel.setToolTipText(tip);
|
||||
else
|
||||
msgIconCLabel.setToolTipText(tip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the message text to display in the title area, given a system message
|
||||
*/
|
||||
private String getMessageText(SystemMessage msg) {
|
||||
//return msg.getFullMessageID()+" " + msg.getLevelOneText();
|
||||
return msg.getLevelOneText();
|
||||
}
|
||||
}
|
|
@ -137,7 +137,7 @@ public abstract class AbstractSystemNewConnectionWizardPage extends AbstractSyst
|
|||
IWizardPage wizardPage = ourWizard.getStartingPage();
|
||||
|
||||
if (wizardPage instanceof RSEDefaultNewConnectionWizardMainPage) {
|
||||
return ((RSEDefaultNewConnectionWizardMainPage)wizardPage).getForm();
|
||||
return ((RSEDefaultNewConnectionWizardMainPage)wizardPage).getSystemConnectionForm();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems, Inc. 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:
|
||||
* Uwe Stieber (Wind River) - initial API and implementation.
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.ui.wizards;
|
||||
|
||||
import org.eclipse.jface.dialogs.DialogPage;
|
||||
import org.eclipse.jface.dialogs.IMessageProvider;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||
|
||||
/**
|
||||
* Message line interface implementation which forwards the calls
|
||||
* to the associated parent dialog page.
|
||||
*/
|
||||
public class RSEDialogPageMessageLine implements ISystemMessageLine {
|
||||
private final DialogPage page;
|
||||
private SystemMessage errorSystemMessage;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param dialogPage The parent dialog page. Must be not <code>null</code>.
|
||||
*/
|
||||
public RSEDialogPageMessageLine(DialogPage dialogPage) {
|
||||
assert dialogPage != null;
|
||||
page = dialogPage;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearErrorMessage()
|
||||
*/
|
||||
public void clearErrorMessage() {
|
||||
assert page != null;
|
||||
if (page.getErrorMessage() != null) page.setErrorMessage(null);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearMessage()
|
||||
*/
|
||||
public void clearMessage() {
|
||||
assert page != null;
|
||||
page.setMessage(null, IMessageProvider.NONE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#getErrorMessage()
|
||||
*/
|
||||
public String getErrorMessage() {
|
||||
assert page != null;
|
||||
return page.getErrorMessage();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#getMessage()
|
||||
*/
|
||||
public String getMessage() {
|
||||
assert page != null;
|
||||
return page.getMessage();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#getSystemErrorMessage()
|
||||
*/
|
||||
public SystemMessage getSystemErrorMessage() {
|
||||
return errorSystemMessage;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String)
|
||||
*/
|
||||
public void setErrorMessage(String message) {
|
||||
assert page != null;
|
||||
// Per Eclipse UI style, wizard pager should never start with errors!
|
||||
if (message != null && message.toLowerCase().startsWith("please enter")) { //$NON-NLS-1$
|
||||
errorSystemMessage = null;
|
||||
page.setErrorMessage(null);
|
||||
setMessage(message);
|
||||
} else {
|
||||
page.setErrorMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
|
||||
*/
|
||||
public void setErrorMessage(SystemMessage message) {
|
||||
errorSystemMessage = message;
|
||||
if (errorSystemMessage != null) setErrorMessage(errorSystemMessage.getLevelOneText());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
|
||||
*/
|
||||
public void setErrorMessage(Throwable exception) {
|
||||
if (exception != null) setErrorMessage(exception.getLocalizedMessage());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setMessage(java.lang.String)
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
assert page != null;
|
||||
page.setMessage(message, IMessageProvider.INFORMATION);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
|
||||
*/
|
||||
public void setMessage(SystemMessage message) {
|
||||
if (message != null) setMessage(message.getLevelOneText());
|
||||
}
|
||||
|
||||
}
|
|
@ -94,8 +94,8 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
|
|||
if (getWizard() instanceof RSEDefaultNewConnectionWizard)
|
||||
{
|
||||
RSEDefaultNewConnectionWizard wizard = (RSEDefaultNewConnectionWizard)getWizard();
|
||||
if (wizard.getMainPage() instanceof RSEDefaultNewConnectionWizardMainPage) {
|
||||
dummyHost = new DummyHost(((RSEDefaultNewConnectionWizardMainPage)wizard.getMainPage()).getHostName(),
|
||||
if (wizard.getStartingPage() instanceof RSEDefaultNewConnectionWizardMainPage) {
|
||||
dummyHost = new DummyHost(((RSEDefaultNewConnectionWizardMainPage)wizard.getStartingPage()).getSystemConnectionForm().getHostName(),
|
||||
wizard.getSystemType() != null ? wizard.getSystemType().getName() : null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class SystemSubSystemsPropertiesWizardPage
|
|||
_thePage = cpage;
|
||||
|
||||
//set the hostname for the page in case it's required
|
||||
if (getMainPage() != null) cpage.setHostname(getMainPage().getHostName());
|
||||
if (getMainPage() != null) cpage.setHostname(getMainPage().getSystemConnectionForm().getHostName());
|
||||
|
||||
numAdded++;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class SystemSubSystemsPropertiesWizardPage
|
|||
}
|
||||
|
||||
//set the hostname for the page in case it's required
|
||||
if (getMainPage() != null) cpage.setHostname(getMainPage().getHostName());
|
||||
if (getMainPage() != null) cpage.setHostname(getMainPage().getSystemConnectionForm().getHostName());
|
||||
|
||||
numAdded++;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ public class SystemSubSystemsPropertiesWizardPage
|
|||
*/
|
||||
public boolean isPageComplete()
|
||||
{
|
||||
String hostName = getMainPage() != null ? getMainPage().getHostName() : null;
|
||||
String hostName = getMainPage() != null ? getMainPage().getSystemConnectionForm().getHostName() : null;
|
||||
if (hostName != null && !hostName.equals(_lastHostName))
|
||||
{
|
||||
hostNameUpdated(hostName);
|
||||
|
|
|
@ -107,20 +107,22 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
subsystemFactorySuppliedWizardPages = getAdditionalWizardPages(systemType.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the wizard pages. This method is an override from the parent Wizard class.
|
||||
*/
|
||||
public void addPages() {
|
||||
try {
|
||||
mainPage = createMainPage(getSystemType());
|
||||
mainPage.setConnectionNameValidators(SystemConnectionForm.getConnectionNameValidators());
|
||||
mainPage.setCurrentlySelectedConnection(selectedContext);
|
||||
|
||||
if (defaultUserId != null) mainPage.setUserId(defaultUserId);
|
||||
if (defaultConnectionName != null) mainPage.setConnectionName(defaultConnectionName);
|
||||
if (defaultHostName != null) mainPage.setHostName(defaultHostName);
|
||||
SystemConnectionForm form = mainPage.getSystemConnectionForm();
|
||||
if (form != null) {
|
||||
form.setCurrentlySelectedConnection(selectedContext);
|
||||
|
||||
if (defaultUserId != null) form.setUserId(defaultUserId);
|
||||
if (defaultConnectionName != null) form.setConnectionName(defaultConnectionName);
|
||||
if (defaultHostName != null) form.setHostName(defaultHostName);
|
||||
}
|
||||
|
||||
if (mainPage != null && getSystemType() != null) mainPage.setSystemType(getSystemType());
|
||||
|
||||
updateDefaultSelectedProfile();
|
||||
|
@ -180,7 +182,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
if (mainPage == null) return;
|
||||
|
||||
List profileNames = activeProfileNames != null ? Arrays.asList(activeProfileNames) : new ArrayList();
|
||||
mainPage.setProfileNames(activeProfileNames);
|
||||
mainPage.getSystemConnectionForm().setProfileNames(activeProfileNames);
|
||||
|
||||
// 1. If a connection is selected, the default profile is the one from the connection.
|
||||
String defaultProfileName = selectedContext != null ? selectedContext.getSystemProfileName() : null;
|
||||
|
@ -197,14 +199,14 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
if (defaultProfileName == null || !profileNames.contains(defaultProfileName)) {
|
||||
// 4. The first non-empty profile from the list of active profiles is the default profile.
|
||||
// Note: The profile names get normalized within the constructor.
|
||||
if (activeProfileNames.length > 0) defaultProfileName = activeProfileNames[0];
|
||||
if (profileNames.size() > 0) defaultProfileName = (String)profileNames.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set the default profile to the page and remember it.
|
||||
if (defaultProfileName != null) {
|
||||
mainPage.setProfileNamePreSelection(defaultProfileName);
|
||||
mainPage.getSystemConnectionForm().setProfileNamePreSelection(defaultProfileName);
|
||||
// do not update the last selected profile marker if the default profile
|
||||
// name came for the selected context.
|
||||
if (selectedContext == null || !defaultProfileName.equals(selectedContext.getSystemProfileName()))
|
||||
|
@ -228,8 +230,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
*/
|
||||
public void setUserId(String userId) {
|
||||
defaultUserId = userId;
|
||||
if (mainPage != null)
|
||||
mainPage.setUserId(userId);
|
||||
if (mainPage != null) mainPage.getSystemConnectionForm().setUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -237,8 +238,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
*/
|
||||
public void setConnectionName(String name) {
|
||||
defaultConnectionName = name;
|
||||
if (mainPage != null)
|
||||
mainPage.setConnectionName(name);
|
||||
if (mainPage != null) mainPage.getSystemConnectionForm().setConnectionName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,8 +246,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
*/
|
||||
public void setHostName(String name) {
|
||||
defaultHostName = name;
|
||||
if (mainPage != null)
|
||||
mainPage.setHostName(name);
|
||||
if (mainPage != null) mainPage.getSystemConnectionForm().setHostName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,7 +271,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
* @return whether the wizard finished successfully
|
||||
*/
|
||||
public boolean performFinish() {
|
||||
boolean ok = mainPage.performFinish();
|
||||
boolean ok = mainPage.getSystemConnectionForm().verify(true);
|
||||
if (!ok)
|
||||
setPageError(mainPage);
|
||||
else if (ok && hasAdditionalPages()) {
|
||||
|
@ -310,8 +309,9 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
if (ok) {
|
||||
try {
|
||||
String sysType = getSystemType() != null ? getSystemType().getName() : null;
|
||||
IHost conn = sr.createHost(mainPage.getProfileName(), sysType, mainPage.getConnectionName(), mainPage.getHostName(),
|
||||
mainPage.getConnectionDescription(), mainPage.getDefaultUserId(), mainPage.getDefaultUserIdLocation(),
|
||||
SystemConnectionForm form = mainPage.getSystemConnectionForm();
|
||||
IHost conn = sr.createHost(form.getProfileName(), sysType, form.getConnectionName(), form.getHostName(),
|
||||
form.getConnectionDescription(), form.getDefaultUserId(), form.getUserIdLocation(),
|
||||
subsystemFactorySuppliedWizardPages);
|
||||
|
||||
setBusyCursor(false);
|
||||
|
@ -329,7 +329,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
sr.expandHost(conn);
|
||||
}
|
||||
|
||||
lastProfile = mainPage.getProfileName();
|
||||
lastProfile = form.getProfileName();
|
||||
} catch (Exception exc) {
|
||||
if (cursorSet)
|
||||
setBusyCursor(false);
|
||||
|
@ -349,30 +349,6 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
return ok;
|
||||
}
|
||||
|
||||
// callbacks from rename page
|
||||
|
||||
/**
|
||||
* Set the new profile name specified on the rename profile page...
|
||||
*/
|
||||
protected void setNewPrivateProfileName(String newName) {
|
||||
activeProfileNames[privateProfileIndex] = newName;
|
||||
if (mainPage != null) {
|
||||
mainPage.setProfileNames(activeProfileNames);
|
||||
mainPage.setProfileNamePreSelection(newName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the main page of this wizard
|
||||
*/
|
||||
public IWizardPage getMainPage() {
|
||||
if (mainPage == null) {
|
||||
addPages();
|
||||
}
|
||||
|
||||
return mainPage;
|
||||
}
|
||||
|
||||
/*
|
||||
* Private method to get all the wizard pages from all the subsystem factories, given a
|
||||
* system type.
|
||||
|
@ -390,8 +366,10 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
|
|||
|
||||
ISystemNewConnectionWizardPage[] pages = adapter.getNewConnectionWizardPages(factories[idx], this);
|
||||
if (pages != null) {
|
||||
for (int widx = 0; widx < pages.length; widx++)
|
||||
for (int widx = 0; widx < pages.length; widx++) {
|
||||
if (pages[widx] instanceof IWizardPage) ((IWizardPage)pages[widx]).setWizard(this);
|
||||
additionalPages.addElement(pages[widx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
subsystemFactorySuppliedWizardPages = new ISystemNewConnectionWizardPage[additionalPages.size()];
|
||||
|
|
|
@ -17,15 +17,17 @@
|
|||
package org.eclipse.rse.ui.wizards.newconnection;
|
||||
import org.eclipse.jface.wizard.IWizard;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.jface.wizard.WizardPage;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.ui.ISystemConnectionFormCaller;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemConnectionForm;
|
||||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||
import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
|
||||
import org.eclipse.rse.ui.wizards.RSEDialogPageMessageLine;
|
||||
import org.eclipse.swt.SWT;
|
||||
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.ui.PlatformUI;
|
||||
|
||||
|
||||
|
||||
|
@ -40,20 +42,25 @@ import org.eclipse.swt.widgets.Control;
|
|||
* </ul>
|
||||
*/
|
||||
|
||||
public class RSEDefaultNewConnectionWizardMainPage extends AbstractSystemWizardPage implements ISystemConnectionFormCaller {
|
||||
|
||||
private SystemConnectionForm form;
|
||||
private String parentHelpId;
|
||||
public class RSEDefaultNewConnectionWizardMainPage extends WizardPage implements ISystemConnectionFormCaller {
|
||||
private final String parentHelpId = RSEUIPlugin.HELPPREFIX + "wncc0000"; //$NON-NLS-1$;
|
||||
|
||||
private SystemConnectionForm form;
|
||||
private final RSEDialogPageMessageLine messageLine;
|
||||
|
||||
/**
|
||||
* Constructor. Use this when you want to supply your own title and
|
||||
* description strings.
|
||||
*/
|
||||
public RSEDefaultNewConnectionWizardMainPage(IWizard wizard, String title, String description) {
|
||||
super(wizard, "NewConnection", title, description); //$NON-NLS-1$
|
||||
super(RSEDefaultNewConnectionWizardMainPage.class.getName());
|
||||
|
||||
parentHelpId = RSEUIPlugin.HELPPREFIX + "wncc0000"; //$NON-NLS-1$
|
||||
setHelp(parentHelpId);
|
||||
if (wizard != null) setWizard(wizard);
|
||||
if (title != null) setTitle(title);
|
||||
if (description != null) setDescription(description);
|
||||
|
||||
// setHelp(parentHelpId);
|
||||
messageLine = new RSEDialogPageMessageLine(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,196 +72,73 @@ public class RSEDefaultNewConnectionWizardMainPage extends AbstractSystemWizardP
|
|||
if (systemType != null) {
|
||||
// The page _always_ restrict the system connection form
|
||||
// to only one system type.
|
||||
getForm().restrictSystemType(systemType.getName());
|
||||
getSystemConnectionForm().restrictSystemType(systemType.getName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrride this if you want to supply your own form. This may be called
|
||||
* multiple times so please only instantatiate if the form instance variable
|
||||
* is null, and then return the form instance variable.
|
||||
* Returns the associated system connection form instance. Override to
|
||||
* return custom system connection forms. As the system connection form
|
||||
* is accessed directly to set and query the managed data of this form,
|
||||
* this method must return always the same instance once the instance has
|
||||
* been created for each subsequent call, until the page is disposed!
|
||||
*
|
||||
* @see org.eclipse.rse.ui.SystemConnectionForm
|
||||
* @return The associated system connection form. Must be never <code>null</code>.
|
||||
*/
|
||||
public SystemConnectionForm getForm() {
|
||||
if (form == null) form = new SystemConnectionForm(this, this);
|
||||
public SystemConnectionForm getSystemConnectionForm() {
|
||||
if (form == null) {
|
||||
form = new SystemConnectionForm(messageLine, this);
|
||||
form.setConnectionNameValidators(SystemConnectionForm.getConnectionNameValidators());
|
||||
}
|
||||
return form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to specify a validator for the connection name. It will be called per keystroke.
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
|
||||
*/
|
||||
public void setConnectionNameValidators(ISystemValidator[] v) {
|
||||
getForm().setConnectionNameValidators(v);
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
if (visible && getSystemConnectionForm() != null && getSystemConnectionForm().getInitialFocusControl() != null) {
|
||||
getSystemConnectionForm().getInitialFocusControl().setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to specify a validator for the hostname. It will be called per keystroke.
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.wizards.AbstractSystemWizardPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
public void setHostNameValidator(ISystemValidator v) {
|
||||
getForm().setHostNameValidator(v);
|
||||
public void createControl(Composite parent) {
|
||||
Composite composite = new Composite(parent, SWT.NONE);
|
||||
composite.setLayout(new GridLayout());
|
||||
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
getSystemConnectionForm().createContents(composite, SystemConnectionForm.CREATE_MODE, parentHelpId);
|
||||
|
||||
setControl(composite);
|
||||
|
||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), parentHelpId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to specify a validator for the userId. It will be called per keystroke.
|
||||
*/
|
||||
public void setUserIdValidator(ISystemValidator v) {
|
||||
getForm().setUserIdValidator(v);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows setting of the initial user Id. Sometimes subsystems
|
||||
* like to have their own default userId preference page option. If so, query
|
||||
* it and set it here by calling this.
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
getForm().setUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the profile names to show in the combo
|
||||
*/
|
||||
public void setProfileNames(String[] names) {
|
||||
getForm().setProfileNames(names);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the profile name to preselect
|
||||
*/
|
||||
public void setProfileNamePreSelection(String name) {
|
||||
getForm().setProfileNamePreSelection(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the currently selected connection so as to better initialize input fields
|
||||
*/
|
||||
public void setCurrentlySelectedConnection(IHost connection) {
|
||||
getForm().setCurrentlySelectedConnection(connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preset the connection name
|
||||
*/
|
||||
public void setConnectionName(String name) {
|
||||
getForm().setConnectionName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preset the host name
|
||||
*/
|
||||
public void setHostName(String name) {
|
||||
getForm().setHostName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* CreateContents is the one method that must be overridden from the parent class.
|
||||
* In this method, we populate an SWT container with widgets and return the container
|
||||
* to the caller (JFace). This is used as the contents of this page.
|
||||
*/
|
||||
public Control createContents(Composite parent) {
|
||||
return getForm().createContents(parent, SystemConnectionForm.CREATE_MODE, parentHelpId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Control to be given initial focus.
|
||||
* Override from parent. Return control to be given initial focus.
|
||||
*/
|
||||
protected Control getInitialFocusControl() {
|
||||
return getForm().getInitialFocusControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Completes processing of the wizard. If this
|
||||
* method returns true, the wizard will close;
|
||||
* otherwise, it will stay active.
|
||||
* This method is an override from the parent Wizard class.
|
||||
*
|
||||
* @return whether the wizard finished successfully
|
||||
*/
|
||||
public boolean performFinish() {
|
||||
return getForm().verify(true);
|
||||
}
|
||||
|
||||
// --------------------------------- //
|
||||
// METHODS FOR EXTRACTING USER DATA ...
|
||||
// --------------------------------- //
|
||||
|
||||
/**
|
||||
* Return user-entered Connection Name.
|
||||
* Call this after finish ends successfully.
|
||||
*/
|
||||
public String getConnectionName() {
|
||||
return getForm().getConnectionName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return user-entered Host Name.
|
||||
* Call this after finish ends successfully.
|
||||
*/
|
||||
public String getHostName() {
|
||||
return getForm().getHostName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return user-entered Default User Id.
|
||||
* Call this after finish ends successfully.
|
||||
*/
|
||||
public String getDefaultUserId() {
|
||||
return getForm().getDefaultUserId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return location where default user id is to be set.
|
||||
* @see org.eclipse.rse.core.IRSEUserIdConstants
|
||||
*/
|
||||
public int getDefaultUserIdLocation() {
|
||||
return getForm().getUserIdLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return user-entered Description.
|
||||
* Call this after finish ends successfully.
|
||||
*/
|
||||
public String getConnectionDescription() {
|
||||
return getForm().getConnectionDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return name of profile to contain new connection.
|
||||
* Call this after finish ends successfully.
|
||||
*/
|
||||
public String getProfileName() {
|
||||
return getForm().getProfileName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return true if the page is complete, so to enable Finish.
|
||||
* Called by wizard framework.
|
||||
*/
|
||||
public boolean isPageComplete() {
|
||||
//System.out.println("Inside isPageComplete. " + form.isPageComplete());
|
||||
if (getForm() != null)
|
||||
return getForm().isPageComplete() && getForm().isConnectionUnique();
|
||||
else
|
||||
return false;
|
||||
if (getSystemConnectionForm() != null)
|
||||
return getSystemConnectionForm().isPageComplete() && getSystemConnectionForm().isConnectionUnique();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept of WizardPage so we know when Next is pressed
|
||||
*/
|
||||
public IWizardPage getNextPage() {
|
||||
//if (wizard == null)
|
||||
//return null;
|
||||
//return wizard.getNextPage(this);
|
||||
|
||||
// verify contents of page before going to main page
|
||||
// this is done because the main page may have input that is not valid, but can
|
||||
// only be verified when next is pressed since it requires a long running operation
|
||||
boolean verify = getForm().verify(true);
|
||||
|
||||
if (!verify) {
|
||||
return null;
|
||||
}
|
||||
if (!getSystemConnectionForm().verify(true)) return null;
|
||||
|
||||
RSEDefaultNewConnectionWizard newConnWizard = getWizard() instanceof RSEDefaultNewConnectionWizard ? (RSEDefaultNewConnectionWizard)getWizard() : null;
|
||||
if (newConnWizard != null) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.eclipse.rse.ui.wizards.newconnection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -48,7 +49,13 @@ import org.eclipse.ui.IWorkbench;
|
|||
public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, ISelectionProvider {
|
||||
protected static final String LAST_SELECTED_SYSTEM_TYPE_ID = "lastSelectedSystemTypeId"; //$NON-NLS-1$
|
||||
|
||||
private IHost selectedContext;
|
||||
// The selected context as passed in from the invoking class.
|
||||
// Just pass on to the wizards. Do not interpret here!
|
||||
// @see #setSelectedContext(ISelection).
|
||||
private ISelection selectedContext;
|
||||
// The connection context as determined from the invoking class
|
||||
// @see #setConnectionContext(IHost)
|
||||
private IHost connectionContext;
|
||||
|
||||
private IWizard selectedWizard;
|
||||
private IRSESystemType selectedSystemType;
|
||||
|
@ -133,6 +140,16 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
|||
onSelectedSystemTypeChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if or if not the main new connection wizard has been restricted to only
|
||||
* one system type.
|
||||
*
|
||||
* @return <code>True</code> if the wizard is restricted to only one system type, <code>false</code> otherwise.
|
||||
*/
|
||||
public final boolean isRestrictedToSingleSystemType() {
|
||||
return onlySystemType;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
|
||||
*/
|
||||
|
@ -167,8 +184,25 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
|||
* @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
|
||||
*/
|
||||
public ISelection getSelection() {
|
||||
IRSESystemType selected = onlySystemType ? restrictedSystemTypes[0] : selectedSystemType;
|
||||
return selected != null ? new StructuredSelection(selected) : null;
|
||||
ISelection selection = null;
|
||||
|
||||
// The system type must be available to construct the selection as
|
||||
// the system type is per contract always the first element
|
||||
IRSESystemType selected = isRestrictedToSingleSystemType() ? restrictedSystemTypes[0] : selectedSystemType;
|
||||
if (selected != null) {
|
||||
List selectionElements = new ArrayList();
|
||||
selectionElements.add(selected);
|
||||
// The second element in the selection is the selected context of the
|
||||
// called as passed in to us (if available).
|
||||
if (selectedContext != null) {
|
||||
selectionElements.add(selectedContext);
|
||||
}
|
||||
|
||||
// construct the selection now
|
||||
selection = new StructuredSelection(selectionElements);
|
||||
}
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -178,23 +212,49 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
|||
if (selection instanceof IStructuredSelection) {
|
||||
IStructuredSelection sel = (IStructuredSelection)selection;
|
||||
if (sel.getFirstElement() instanceof IRSESystemType) {
|
||||
// update the selected system type.
|
||||
selectedSystemType = (IRSESystemType)((IStructuredSelection)selection).getFirstElement();
|
||||
} else if (sel.getFirstElement() instanceof IHost) {
|
||||
selectedContext = (IHost)sel.getFirstElement();
|
||||
if (selectedContext.getSystemType() != null) {
|
||||
String systemTypeName = selectedContext.getSystemType();
|
||||
IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeName);
|
||||
if (systemType != null) {
|
||||
selectedSystemType = systemType;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectedSystemType = null;
|
||||
}
|
||||
|
||||
// signal the system type change
|
||||
onSelectedSystemTypeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the currently selected context for the wizard as know by the caller
|
||||
* of this method. The selected context is not interpreted by the main wizard,
|
||||
* the selection is passed on as is to the nested wizards.
|
||||
*
|
||||
* @param selectedContext The selected context or <code>null</code>.
|
||||
*/
|
||||
public void setSelectedContext(ISelection selectedContext) {
|
||||
this.selectedContext = selectedContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the connection context for the wizard as determinded from
|
||||
* the caller of this method. If non-null, the method will query
|
||||
* the connections context system type and invoke <code>
|
||||
* setSelection(...)</code> to apply the system type as the selected
|
||||
* one.
|
||||
*
|
||||
* @param connectionContext The connection context or <code>null</code>.
|
||||
*/
|
||||
public void setConnectionContext(IHost connectionContext) {
|
||||
this.connectionContext = connectionContext;
|
||||
// If there is an connection context, extract the connections
|
||||
// system type from the connection context as use as default
|
||||
if (connectionContext != null && connectionContext.getSystemType() != null) {
|
||||
String systemTypeName = connectionContext.getSystemType();
|
||||
IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeName);
|
||||
// if we have found the system type object, pass on to setSelection(...)!
|
||||
if (systemType != null) setSelection(new StructuredSelection(systemType));
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
|
||||
*/
|
||||
|
@ -230,11 +290,16 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
|||
selectedWizardCanFinishEarly = false;
|
||||
}
|
||||
|
||||
// Check on the container association of the selected wizard.
|
||||
if (getContainer() != null && selectedWizard != null && !getContainer().equals(selectedWizard.getContainer())) {
|
||||
selectedWizard.setContainer(getContainer());
|
||||
}
|
||||
|
||||
// if the newly selected wizard is the default RSE new connection wizard
|
||||
// and the selected context is non-null, set the selected context to the
|
||||
// default RSE new connection wizard.
|
||||
if (selectedWizard instanceof RSEDefaultNewConnectionWizard) {
|
||||
((RSEDefaultNewConnectionWizard)selectedWizard).setSelectedContext(selectedContext);
|
||||
((RSEDefaultNewConnectionWizard)selectedWizard).setSelectedContext(connectionContext);
|
||||
}
|
||||
|
||||
// register the newly selected wizard as selection changed listener
|
||||
|
@ -242,15 +307,15 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
|||
addSelectionChangedListener((ISelectionChangedListener)selectedWizard);
|
||||
}
|
||||
|
||||
// notify the selection changed event to the listeners
|
||||
fireSelectionChanged();
|
||||
|
||||
// Initialize the wizard pages and remember which wizard we have initialized already
|
||||
if (selectedWizard != null && !initializedWizards.contains(selectedWizard)) {
|
||||
selectedWizard.addPages();
|
||||
initializedWizards.add(selectedWizard);
|
||||
}
|
||||
|
||||
// notify the selection changed event to the listeners
|
||||
fireSelectionChanged();
|
||||
|
||||
// Update the wizard container UI elements
|
||||
IWizardContainer container = getContainer();
|
||||
if (container != null && container.getCurrentPage() != null) {
|
||||
|
@ -261,20 +326,10 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
|||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.wizard.Wizard#getStartingPage()
|
||||
*/
|
||||
public IWizardPage getStartingPage() {
|
||||
if (onlySystemType && getSelectedWizard() != null) return getSelectedWizard().getStartingPage();
|
||||
return super.getStartingPage();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.wizards.AbstractSystemWizard#addPages()
|
||||
* @see org.eclipse.jface.wizard.Wizard#addPages()
|
||||
*/
|
||||
public void addPages() {
|
||||
// It we are not restricted to only one system type, add the
|
||||
// system type selection page.
|
||||
if (!onlySystemType) addPage(mainPage);
|
||||
addPage(mainPage);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -305,10 +360,6 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
|||
* @see org.eclipse.rse.ui.wizards.AbstractSystemWizard#performFinish()
|
||||
*/
|
||||
public boolean performFinish() {
|
||||
// Note: Do _NOT_ delegate the performFinish from here to the selected
|
||||
// wizard!! The outer wizard dialog is handling the nested wizards by
|
||||
// default already itself!!
|
||||
|
||||
// Save the current selection to the dialog settings
|
||||
IDialogSettings dialogSettings = getDialogSettings();
|
||||
if (dialogSettings != null && getSelection() instanceof IStructuredSelection) {
|
||||
|
@ -318,6 +369,8 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
|||
}
|
||||
}
|
||||
|
||||
if (mainPage != null) mainPage.saveWidgetValues();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
|
||||
package org.eclipse.rse.ui.wizards.newconnection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||
|
@ -37,7 +39,10 @@ import org.eclipse.rse.core.IRSESystemType;
|
|||
import org.eclipse.rse.ui.RSESystemTypeAdapter;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemResources;
|
||||
import org.eclipse.rse.ui.wizards.registries.IRSEWizardCategory;
|
||||
import org.eclipse.rse.ui.wizards.registries.IRSEWizardRegistryElement;
|
||||
import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeContentProvider;
|
||||
import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeElement;
|
||||
import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeLabelProvider;
|
||||
import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreePatternFilter;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -55,6 +60,9 @@ import org.eclipse.ui.dialogs.PatternFilter;
|
|||
public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
||||
private final String helpId = RSEUIPlugin.HELPPREFIX + "wncc0000"; //$NON-NLS-1$;
|
||||
|
||||
private static final String EXPANDED_CATEGORIES_SETTINGS_ID = "filteredTree.expandedCatogryIds"; //$NON-NLS-1$
|
||||
private static final String[] DEFAULT_EXPANDED_CATEGORY_IDS = new String[] { "org.eclipse.rse.ui.wizards.newconnection.default.category" }; //$NON-NLS-1$
|
||||
|
||||
private IRSESystemType[] restrictedSystemTypes;
|
||||
|
||||
private FilteredTree filteredTree;
|
||||
|
@ -184,7 +192,6 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
|||
// Explicitly allow the tree items to get decorated!!!
|
||||
treeViewer.setLabelProvider(new DecoratingLabelProvider(new RSEWizardSelectionTreeLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
|
||||
treeViewer.setComparator(new NewConnectionWizardViewerComparator());
|
||||
treeViewer.setAutoExpandLevel(2);
|
||||
|
||||
filteredTreeWizardStateFilter = new NewConnectionWizardStateFilter();
|
||||
treeViewer.addFilter(filteredTreeWizardStateFilter);
|
||||
|
@ -208,6 +215,10 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
|||
|
||||
setControl(composite);
|
||||
|
||||
// Restore the expanded state of the category items within the tree
|
||||
// before initializing the selection.
|
||||
restoreWidgetValues();
|
||||
|
||||
// Initialize the selection in the tree
|
||||
if (getWizard() instanceof ISelectionProvider) {
|
||||
ISelectionProvider selectionProvider = (ISelectionProvider)getWizard();
|
||||
|
@ -220,13 +231,12 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// we put the initial focus into the filter field
|
||||
filteredTree.getFilterControl().setFocus();
|
||||
|
||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), helpId);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.DialogPage#performHelp()
|
||||
*/
|
||||
public void performHelp() {
|
||||
PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,4 +285,61 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
|||
|
||||
return settings;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
|
||||
*/
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
// if the page will become hidden, save the expansion state of
|
||||
// the tree elements.
|
||||
if (!visible) saveWidgetValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the tree state from the dialog settings.
|
||||
*/
|
||||
public void restoreWidgetValues() {
|
||||
IDialogSettings settings = getDialogSettings();
|
||||
if (settings != null) {
|
||||
String[] expandedCategories = settings.getArray(EXPANDED_CATEGORIES_SETTINGS_ID);
|
||||
// by default we expand always the "General" category.
|
||||
if (expandedCategories == null) expandedCategories = DEFAULT_EXPANDED_CATEGORY_IDS;
|
||||
if (expandedCategories != null) {
|
||||
List expanded = new ArrayList();
|
||||
for (int i = 0; i < expandedCategories.length; i++) {
|
||||
String categoryId = expandedCategories[i];
|
||||
if (categoryId != null && !"".equals(categoryId.trim())) { //$NON-NLS-1$
|
||||
IRSEWizardRegistryElement registryElement = RSENewConnectionWizardRegistry.getInstance().findElementById(categoryId);
|
||||
if (registryElement instanceof IRSEWizardCategory) {
|
||||
RSEWizardSelectionTreeElement treeElement = filteredTreeDataManager.getTreeElementForCategory((IRSEWizardCategory)registryElement);
|
||||
if (treeElement != null) expanded.add(treeElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (expanded.size() > 0) filteredTree.getViewer().setExpandedElements(expanded.toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the tree state to the dialog settings.
|
||||
*/
|
||||
public void saveWidgetValues() {
|
||||
IDialogSettings settings = getDialogSettings();
|
||||
if (settings != null) {
|
||||
List expandedCategories = new ArrayList();
|
||||
Object[] expanded = filteredTree.getViewer().getVisibleExpandedElements();
|
||||
for (int i = 0; i < expanded.length; i++) {
|
||||
if (expanded[i] instanceof RSEWizardSelectionTreeElement) {
|
||||
IRSEWizardRegistryElement registryElement = ((RSEWizardSelectionTreeElement)expanded[i]).getWizardRegistryElement();
|
||||
if (registryElement instanceof IRSEWizardCategory) {
|
||||
expandedCategories.add(((IRSEWizardCategory)registryElement).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
settings.put(EXPANDED_CATEGORIES_SETTINGS_ID, (String[])expandedCategories.toArray(new String[expandedCategories.size()]));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,6 +31,9 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
|||
// and the wizard using these different object instances in their selections!
|
||||
private Map elementMap;
|
||||
|
||||
// The category map is doing the same as the element but for categories.
|
||||
private Map categoryMap;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
@ -50,6 +53,17 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
|||
return (RSENewConnectionWizardSelectionTreeElement)elementMap.get(systemType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding wizard selection tree element for the specified category.
|
||||
*
|
||||
* @param category The category. Must be not <code>null</code>.
|
||||
* @return The wizard selection tree element or <code>null</code>.
|
||||
*/
|
||||
public RSEWizardSelectionTreeElement getTreeElementForCategory(IRSEWizardCategory category) {
|
||||
assert category != null;
|
||||
return (RSEWizardSelectionTreeElement)categoryMap.get(category);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.internal.wizards.newconnection.RSEAbstractWizardSelectionTreeDataManager#initialize(java.util.Set)
|
||||
*/
|
||||
|
@ -60,7 +74,8 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
|||
if (elementMap == null) elementMap = new HashMap();
|
||||
elementMap.clear();
|
||||
|
||||
Map categoryCache = new HashMap();
|
||||
if (categoryMap == null) categoryMap = new HashMap();
|
||||
categoryMap.clear();
|
||||
|
||||
// The new connection wizard selection is combining system types
|
||||
// with registered new connection wizard.
|
||||
|
@ -106,11 +121,11 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
|||
|
||||
// if the category id is not null, check if we have accessed the category
|
||||
// already once.
|
||||
RSEWizardSelectionTreeElement categoryElement = (RSEWizardSelectionTreeElement)categoryCache.get(category);
|
||||
RSEWizardSelectionTreeElement categoryElement = (RSEWizardSelectionTreeElement)categoryMap.get(category);
|
||||
if (categoryElement == null) {
|
||||
categoryElement = new RSEWizardSelectionTreeElement(category);
|
||||
categoryElement.setParentElement(null);
|
||||
categoryCache.put(category, categoryElement);
|
||||
categoryMap.put(category, categoryElement);
|
||||
}
|
||||
categoryElement.add(wizardElement);
|
||||
wizardElement.setParentElement(categoryElement);
|
||||
|
@ -131,11 +146,11 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
|||
|
||||
category = (IRSEWizardCategory)candidate;
|
||||
|
||||
RSEWizardSelectionTreeElement parentElement = (RSEWizardSelectionTreeElement)categoryCache.get(category);
|
||||
RSEWizardSelectionTreeElement parentElement = (RSEWizardSelectionTreeElement)categoryMap.get(category);
|
||||
if (parentElement == null) {
|
||||
parentElement = new RSEWizardSelectionTreeElement(category);
|
||||
parentElement.setParentElement(null);
|
||||
categoryCache.put(category, parentElement);
|
||||
categoryMap.put(category, parentElement);
|
||||
}
|
||||
parentElement.add(categoryElement);
|
||||
categoryElement.setParentElement(parentElement);
|
||||
|
|
|
@ -10,7 +10,14 @@
|
|||
<p>
|
||||
Each system type must have exactly one new connection wizard associated. In case multiple new connection wizard contributions would match the same system type, the new connection wizard which matched the system type first, will be used.
|
||||
<p>
|
||||
One new connection wizard may be registered for multiple system types. Such wizards should implement the <code>org.eclipse.jface.viewers.ISelectionChangedListener</code> interface to get notified about the currently selected system type within the new connection system type selection page.
|
||||
One new connection wizard may be registered for multiple system types. Such wizards should implement the <code>org.eclipse.jface.viewers.ISelectionChangedListener</code> interface. to get notified about the currently selected system type within the new connection system type selection page.
|
||||
<p>
|
||||
<b>Note:</b> The main RSE new connection wizard is using the <code>selectionChanged(SelectionChangedEvent)</code> to notify the nested wizards about
|
||||
<ul>
|
||||
<li> system type selection changes in the RSE new connection wizard selection page and</li>
|
||||
<li> the selected context of a view or toolbar or menu the caller of the main RSE new connection wizard is passing in.</li>
|
||||
</ul><br>
|
||||
If the caller of the main RSE new connection wizard has passed in a selected context, the structured selection given via the <code>selectionChanged</code> call has two elements. The first element is always the selected system type (instance of type <code>IRSESystemType</code>) and the second one, if present, is the selected context from the caller (instance of type <code>ISelection</code>).
|
||||
<p>
|
||||
New connection wizard may have the need of contributing different attribute values for the same attribute dependent on the current system type selection. These wizards should implement the <code>org.eclipse.rse.ui.wizards.newconnection.IRSEDynamicNewConnectionWizard</code>.
|
||||
</documentation>
|
||||
|
@ -164,18 +171,17 @@ The default RSE wizard category id is "org.eclipse.rse.ui.wizards.newconnec
|
|||
|
||||
<p>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.eclipse.rse.ui.newConnectionWizard">
|
||||
<category id="org.eclipse.rse.ui.wizards.newconnection.default.category"
|
||||
name="%Creation.category.name"/>
|
||||
<newConnectionWizard
|
||||
id="org.eclipse.rse.ui.wizards.newconnection.RSEDefaultnNewConnectionWizard"
|
||||
<extension point="org.eclipse.rse.ui.newConnectionWizard">
|
||||
<category id="org.eclipse.rse.ui.wizards.newconnection.default.category"
|
||||
name="%Creation.category.name"/>
|
||||
<newConnectionWizard
|
||||
id="org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard"
|
||||
class="org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard"
|
||||
name="%DefaultRSENewConnectionWizard.name"
|
||||
canFinishEarly="false"
|
||||
canFinishEarly="false"
|
||||
categoryId="org.eclipse.rse.ui.wizards.newconnection.default.category"
|
||||
hasPages="true">
|
||||
</newConnectionWizard>
|
||||
</newConnectionWizard>
|
||||
</extension>
|
||||
</pre>
|
||||
</p>
|
||||
|
|
|
@ -93,19 +93,19 @@ Contributors:
|
|||
<LevelTwo>The name must be a valid file name within the workbench and the underlying file system.</LevelTwo>
|
||||
</Message>
|
||||
<Message ID="1020" Indicator="E">
|
||||
<LevelOne>Enter system type</LevelOne>
|
||||
<LevelOne>Please enter a valid system type.</LevelOne>
|
||||
<LevelTwo>You must select a system type. The system type is the type of the operating system of the remote sytem.</LevelTwo>
|
||||
</Message>
|
||||
<Message ID="1021" Indicator="E">
|
||||
<LevelOne>Enter connection name</LevelOne>
|
||||
<LevelOne>Please enter a valid connection name.</LevelOne>
|
||||
<LevelTwo>You must enter a connection name. This name is arbitrary, but must be unique to the selected profile.</LevelTwo>
|
||||
</Message>
|
||||
<Message ID="1022" Indicator="E">
|
||||
<LevelOne>Connection name is not unique for its profile</LevelOne>
|
||||
<LevelOne>Connection name is not unique for the selected profile.</LevelOne>
|
||||
<LevelTwo>Connection names must be unique to the profile that contains the connection. Specify a name not already in use.</LevelTwo>
|
||||
</Message>
|
||||
<Message ID="1023" Indicator="E">
|
||||
<LevelOne>Not a valid connection name</LevelOne>
|
||||
<LevelOne>Invalid connection name. Must be a valid folder name in the underlaying file system.</LevelOne>
|
||||
<LevelTwo>The connection name is not syntactically valid. The name must be a valid folder name within the workbench and the underlying file system.</LevelTwo>
|
||||
</Message>
|
||||
<Message ID="1024" Indicator="E">
|
||||
|
|
Loading…
Add table
Reference in a new issue