-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEIIDDES-2459: Adds version guard listener
* In addition to dialog question when calling the SetDefaultServerAction, a warning should be displayed if a server is added and its the first * ServerVersionGuard listener for default server changes and displays a warning if the server version is greater than the default
- Loading branch information
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...rg.teiid.designer.dqp.ui/src/org/teiid/designer/runtime/ui/server/ServerVersionGuard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. | ||
* | ||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. | ||
*/ | ||
package org.teiid.designer.runtime.ui.server; | ||
|
||
import static org.teiid.designer.runtime.ui.DqpUiConstants.UTIL; | ||
import org.eclipse.jface.dialogs.MessageDialog; | ||
import org.eclipse.ui.IWorkbench; | ||
import org.eclipse.ui.IWorkbenchWindow; | ||
import org.teiid.core.designer.util.StringConstants; | ||
import org.teiid.designer.runtime.spi.ExecutionConfigurationEvent; | ||
import org.teiid.designer.runtime.spi.IExecutionConfigurationListener; | ||
import org.teiid.designer.runtime.spi.ITeiidServer; | ||
import org.teiid.designer.runtime.ui.DqpUiPlugin; | ||
import org.teiid.designer.runtime.version.spi.ITeiidServerVersion; | ||
import org.teiid.designer.runtime.version.spi.TeiidServerVersion; | ||
|
||
/** | ||
* | ||
*/ | ||
public class ServerVersionGuard implements IExecutionConfigurationListener, StringConstants { | ||
|
||
private static IExecutionConfigurationListener instance; | ||
|
||
/** | ||
* @return singleton instance | ||
*/ | ||
public static IExecutionConfigurationListener getInstance() { | ||
if (instance == null) | ||
instance = new ServerVersionGuard(); | ||
|
||
return instance; | ||
} | ||
|
||
@Override | ||
public void configurationChanged(ExecutionConfigurationEvent event) { | ||
if (ExecutionConfigurationEvent.EventType.DEFAULT != event.getEventType()) | ||
return; | ||
|
||
if (ExecutionConfigurationEvent.TargetType.SERVER != event.getTargetType()) | ||
return; | ||
|
||
ITeiidServer instance = event.getUpdatedServer(); | ||
ITeiidServerVersion version = instance.getServerVersion(); | ||
if (! version.isGreaterThan(TeiidServerVersion.Version.TEIID_DEFAULT.get())) | ||
return; | ||
|
||
IWorkbench workbench = DqpUiPlugin.getDefault().getWorkbench(); | ||
if (workbench == null) | ||
return; | ||
|
||
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); | ||
if (window == null) | ||
return; | ||
|
||
MessageDialog.openWarning(window.getShell(), | ||
UTIL.getString(getClass().getSimpleName() + DOT + "notifyUnsupportedMsgTitle"), //$NON-NLS-1$ | ||
UTIL.getString(getClass().getSimpleName() + DOT + "notifyUnsupportedMsg")); //$NON-NLS-1$ | ||
} | ||
|
||
} |