Skip to content

Commit

Permalink
Small fixes to TeiidView and new server wizard
Browse files Browse the repository at this point in the history
* ServerPage
* ServerWizard
 * Ensure the jdbc URL textbox is populated once the teiid server
   has been created from the new jboss server
 * If the wizard is cancelled then remove the newly created jboss
   server.

* TeiidView
 * If there are no jboss servers then the server hyperlink displays
   'new' label while once there is a server then it becomes 'edit'.
 * Clicking the hyperlink will open the new server wizard if there
   are no jboss servers.
  • Loading branch information
Paul Richardson committed Sep 21, 2012
1 parent 3a5e86f commit 94eda21
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ serverPagePasswordToolTip = The password used to authenticate the user when conn
serverPageJDBCUrlLabel = JDBC URL Template
serverPageJDBCUrlToolTip = The URL used to create the JDBC connection to your VDB on the Teiid server

serverPageOKStatusMsg = serverPageOkStatusMsg = Define the Teiid Server connection properties required to perform both JDBC and Admin tasks.
serverPageOkStatusMsg = Define the Teiid Server connection properties required to perform both JDBC and Admin tasks.
serverPageServerNotStarted = The new jboss server has not been started
serverPageNewServerNotCompatibleWithTeiid =The new server does has not been configured with teiidor is not compatible. Ensure that it is at least a JBoss version 7+ instance.
serverPageEmptyCustomLabelMsg = Name cannot be empty
Expand Down Expand Up @@ -612,7 +612,8 @@ TeiidServerOverviewSection.description=General settings
TeiidServerOverviewSection.customLabel=Display Name
TeiidServerOverviewSection.hostLabel=Host
TeiidServerOverviewSection.jbLabel=JBoss Server
TeiidServerOverviewSection.hyperlinkLabel=Edit JBoss Server
TeiidServerOverviewSection.newHyperlinkLabel=New JBoss Server
TeiidServerOverviewSection.editHyperlinkLabel=Edit JBoss Server

TeiidServerAdminSection.title=Administration Connection
TeiidServerAdminSection.description=<form><p>Administration is performed via the <a href="">jboss</a> management configuration</p></form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package org.teiid.designer.runtime.ui.server;

import static org.teiid.designer.runtime.ui.DqpUiConstants.UTIL;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IMessageProvider;
Expand Down Expand Up @@ -322,6 +323,8 @@ public void run() {
if (TeiidJdbcInfo.DEFAULT_JDBC_PASSWORD.equals(jdbcPasswordText.getText()))
jdbcPasswordText.setText(teiidJdbcInfo.getPassword());

jdbcURLText.setText(teiidJdbcInfo.getUrl());

String displayName = displayNameText.getText();
if (displayName != null && displayName.length() > 0)
teiidServer.setCustomLabel(displayName);
Expand Down Expand Up @@ -455,4 +458,21 @@ IStatus performFinish() {

return status;
}

/**
* Processing done after wizard 'Cancel' button is clicked. Wizard was cancelled
*/
public void performCancel() {
if (teiidServer == null)
return;

try {
IServer server = teiidServer.getParent();
if (server != null)
server.delete();

} catch (CoreException ex) {
UTIL.log(ex);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ public IDialogSettings getDialogSettings() {
protected TeiidServerManager getServerManager() {
return this.teiidServerManager;
}

/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performCancel()
*/
@Override
public boolean performCancel() {
this.page.performCancel();
return super.performCancel();
}

/**
* {@inheritDoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import org.teiid.designer.runtime.connection.SourceConnectionBinding;
import org.teiid.designer.runtime.ui.DqpUiConstants;
import org.teiid.designer.runtime.ui.DqpUiPlugin;
import org.teiid.designer.runtime.ui.server.NewServerAction;
import org.teiid.designer.runtime.ui.views.content.TeiidEmptyNode;
import org.teiid.designer.runtime.ui.views.content.TeiidFolder;
import org.teiid.designer.ui.common.eventsupport.SelectionUtilities;
Expand All @@ -82,8 +83,18 @@
*
* @since 8.0
*/
public class TeiidView extends CommonNavigator implements IExecutionConfigurationListener {

public class TeiidView extends CommonNavigator implements DqpUiConstants, IExecutionConfigurationListener {

/**
* Text constant for the server hyperlink label when there are servers available
*/
private static final String NEW_SERVER_LABEL = UTIL.getString("TeiidServerOverviewSection.newHyperlinkLabel"); //$NON-NLS-1$

/**
* Text constant for the server hyperlink label when there are servers available
*/
private static final String EDIT_SERVER_LABEL = UTIL.getString("TeiidServerOverviewSection.editHyperlinkLabel"); //$NON-NLS-1$

/**
* A <code>ViewerFilter</code> that hides Preview Data Sources.
*/
Expand Down Expand Up @@ -144,12 +155,12 @@ public boolean select( Viewer viewer,
private static IMemento viewMemento;

static String getString( final String stringId ) {
return DqpUiConstants.UTIL.getString(PREFIX + stringId);
return UTIL.getString(PREFIX + stringId);
}

static String getString( final String stringId,
final Object param ) {
return DqpUiConstants.UTIL.getString(PREFIX + stringId, param);
return UTIL.getString(PREFIX + stringId, param);
}

private Combo jbossServerCombo;
Expand Down Expand Up @@ -193,12 +204,14 @@ public void serverRemoved(IServer server) {
}
};

/**


private Hyperlink newServerOrOpenServerViewHyperlink; /**
* The constructor.
*/
public TeiidView() {
this.setPartName(getString("title.text")); //$NON-NLS-1$
this.setTitleImage(DqpUiPlugin.getDefault().getImage(DqpUiConstants.Images.SOURCE_BINDING_ICON));
this.setTitleImage(DqpUiPlugin.getDefault().getImage(Images.SOURCE_BINDING_ICON));
this.setTitleToolTip(getString("title.tooltip")); //$NON-NLS-1$
}

Expand Down Expand Up @@ -247,7 +260,7 @@ public void createPartControl( Composite parent ) {
GridDataFactory.fillDefaults().applyTo(comboFrame);
GridLayoutFactory.fillDefaults().margins(5, 20).applyTo(comboFrame);

Label jbLabel = WidgetFactory.createLabel(comboFrame, DqpUiConstants.UTIL.getString("TeiidServerOverviewSection.jbLabel")); //$NON-NLS-1$
Label jbLabel = WidgetFactory.createLabel(comboFrame, UTIL.getString("TeiidServerOverviewSection.jbLabel")); //$NON-NLS-1$
jbLabel.setForeground(comboFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));
GridDataFactory.swtDefaults().grab(true, false).applyTo(jbLabel);

Expand All @@ -267,19 +280,25 @@ public void widgetDefaultSelected(SelectionEvent e) {
}
});

Hyperlink openServerViewHyperlink = toolkit.createHyperlink(comboFrame,
DqpUiConstants.UTIL.getString("TeiidServerOverviewSection.hyperlinkLabel"), SWT.NONE); //$NON-NLS-1$
GridDataFactory.swtDefaults().applyTo(openServerViewHyperlink);
openServerViewHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
newServerOrOpenServerViewHyperlink = toolkit.createHyperlink(comboFrame,
EDIT_SERVER_LABEL, SWT.NONE);
GridDataFactory.swtDefaults().applyTo(newServerOrOpenServerViewHyperlink);
newServerOrOpenServerViewHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

@Override
public void linkActivated(HyperlinkEvent e) {
//open view
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
try {
window.getActivePage().showView("org.eclipse.wst.server.ui.ServersView"); //$NON-NLS-1$
} catch (PartInitException ex) {
DqpUiConstants.UTIL.log(ex);
if (serverMap.isEmpty()) {
// There are no servers so open the server wizard
NewServerAction action = new NewServerAction(getViewSite().getShell(), getServerManager());
action.run();
} else {
//open the servers view
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
try {
window.getActivePage().showView("org.eclipse.wst.server.ui.ServersView"); //$NON-NLS-1$
} catch (PartInitException ex) {
UTIL.log(ex);
}
}
}
});
Expand Down Expand Up @@ -328,8 +347,12 @@ private void populateJBossServerCombo() {
String[] items = serverMap.keySet().toArray(new String[0]);
jbossServerCombo.setItems(items);

if (items.length > 0)
if (items.length == 0) {
newServerOrOpenServerViewHyperlink.setText(NEW_SERVER_LABEL);
} else {
newServerOrOpenServerViewHyperlink.setText(EDIT_SERVER_LABEL);
jbossServerCombo.setText(items[0]);
}

// even if nothing in combo, still want the viewer to refresh
handleServerComboSelection();
Expand Down

0 comments on commit 94eda21

Please sign in to comment.