use of org.eclipse.jface.dialogs.Dialog in project tdi-studio-se by Talend.
the class RowGeneratorComponent method open.
/*
* (non-Javadoc)
*
* @see org.talend.designer.core.model.components.IExternalComponent#open()
*/
@Override
public int open(final Composite parent) {
initRowGeneratorMain();
rowGeneratorMain.createModelFromExternalData(getIODataComponents(), getMetadataList(), externalData, true);
Dialog dialog = rowGeneratorMain.createRowGeneratorDialog(parent.getShell());
dialog.open();
return rowGeneratorMain.getMapperDialogResponse();
}
use of org.eclipse.jface.dialogs.Dialog in project tdi-studio-se by Talend.
the class AbstractElementPropertySectionController method openSQLBuilder.
/**
* DOC qzhang Comment method "openSQLBuilder".
*
* @param repositoryType
* @param propertyName
* @param query
*/
protected String openSQLBuilder(String repositoryType, String propertyName, String query) {
if (repositoryType.equals(EmfComponent.BUILTIN)) {
connParameters.setQuery(query);
if (connParameters.isShowConfigParamDialog()) {
if (!isUseExistingConnection()) {
initConnectionParametersWithContext(elem, part.getProcess().getContextManager().getDefaultContext());
} else {
initConnectionParametersWithContext(connectionNode, part.getProcess().getContextManager().getDefaultContext());
}
}
// add for bug TDI-20335
if (part == null) {
Shell parentShell = new Shell(composite.getShell().getDisplay());
ISQLBuilderService service = (ISQLBuilderService) GlobalServiceRegister.getDefault().getService(ISQLBuilderService.class);
Dialog sqlBuilder = service.openSQLBuilderDialog(parentShell, "", connParameters);
sqlBuilder.open();
} else {
openSqlBuilderBuildIn(connParameters, propertyName);
}
} else if (repositoryType.equals(EmfComponent.REPOSITORY)) {
//$NON-NLS-1$
String repositoryName2 = "";
String repositoryId = null;
IElementParameter memoParam = elem.getElementParameter(propertyName);
IElementParameter repositoryParam = null;
for (IElementParameter param : elem.getElementParameters()) {
if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE && param.getRepositoryValue().startsWith("DATABASE")) {
repositoryParam = param;
break;
}
}
// in case no database property found, take the first property (to keep compatibility with old code)
if (repositoryParam == null) {
for (IElementParameter param : elem.getElementParameters()) {
if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
repositoryParam = param;
break;
}
}
}
if (repositoryParam != null) {
IElementParameter itemFromRepository = repositoryParam.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
String value = (String) itemFromRepository.getValue();
repositoryId = value;
// for (String key : this.dynamicProperty.getRepositoryConnectionItemMap().keySet()) {
// if (key.equals(value)) {
// repositoryName2 =
// this.dynamicProperty.getRepositoryConnectionItemMap().get(key).getProperty().getLabel();
// }
// }
/* get connection item dynamictly,not from cache ,see 16969 */
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
try {
IRepositoryViewObject repobj = factory.getLastVersion(value);
if (repobj != null) {
Property property = repobj.getProperty();
if (property != null) {
repositoryName2 = property.getLabel();
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
// When no repository avaiable on "Repository" mode, open a MessageDialog.
if (repositoryName2 == null || repositoryName2.length() == 0) {
MessageDialog.openError(composite.getShell(), Messages.getString("NoRepositoryDialog.Title"), //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"NoRepositoryDialog.Text"));
return null;
}
// Part maybe not exist
//$NON-NLS-1$
String processName = "";
//$NON-NLS-1$
String key = "";
if (elem instanceof Node) {
processName = ((Node) elem).getProcess().getName();
key = processName + ((Node) elem).getUniqueName();
} else if (elem instanceof IProcess) {
processName = ((IProcess) elem).getName();
key = processName;
}
key += repositoryName2;
final Dialog builderDialog = sqlbuilers.get(key);
if (!composite.isDisposed() && builderDialog != null && builderDialog.getShell() != null && !builderDialog.getShell().isDisposed()) {
builderDialog.getShell().setActive();
} else {
connParameters.setRepositoryName(repositoryName2);
if (repositoryId != null) {
connParameters.setRepositoryId(repositoryId);
}
Shell parentShell = new Shell(composite.getShell().getDisplay());
String nodeLabel = null;
if (elem instanceof Node) {
nodeLabel = (String) ((Node) elem).getElementParameter(EParameterName.LABEL.getName()).getValue();
}
TextUtil.setDialogTitle(processName, nodeLabel, elem.getElementName());
ISQLBuilderService service = (ISQLBuilderService) GlobalServiceRegister.getDefault().getService(ISQLBuilderService.class);
connParameters.setQuery(query);
// first open Sql Builder,set true
connParameters.setFirstOpenSqlBuilder(true);
Dialog sqlBuilder = service.openSQLBuilderDialog(parentShell, processName, connParameters);
sqlbuilers.put(key, sqlBuilder);
if (Window.OK == sqlBuilder.open()) {
if (!composite.isDisposed() && !connParameters.isNodeReadOnly()) {
String sql = connParameters.getQuery();
// modified by hyWang
if (!connParameters.getIfContextButtonCheckedFromBuiltIn()) {
sql = QueryUtil.checkAndAddQuotes(sql);
}
return sql;
}
}
}
}
return null;
}
use of org.eclipse.jface.dialogs.Dialog in project cubrid-manager by CUBRID.
the class PropertyAction method run.
/**
* Open property dialog,view and set property
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
return;
}
final ICubridNode node = (ICubridNode) obj[0];
String type = node.getType();
if (CubridNodeType.SERVER.equals(type) || CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type) || CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
TaskExecutor taskExcutor = new GetPropertyExecutor(node, getShell());
ServerInfo serverInfo = node.getServer().getServerInfo();
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo);
GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
if (CubridNodeType.SERVER.equals(type)) {
taskExcutor.addTask(getCubridConfParameterTask);
taskExcutor.addTask(getBrokerConfParameterTask);
taskExcutor.addTask(getCMConfParameterTask);
if (CompatibleUtil.isSupportNewHAConfFile(serverInfo)) {
GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
taskExcutor.addTask(getHAConfParameterTask);
}
}
if (CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type)) {
taskExcutor.addTask(getCubridConfParameterTask);
}
if (CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
taskExcutor.addTask(getBrokerConfParameterTask);
}
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
}
if (!isCancel) {
Dialog dialog = PreferenceUtil.createPropertyDialog(getShell(), node);
dialog.open();
}
}
use of org.eclipse.jface.dialogs.Dialog in project translationstudio8 by heartsome.
the class ConfigureColumnsAction method run.
/**
* {@inheritDoc}
*/
public void run() {
save();
Dialog confColsDialog = new Dialog(Display.getCurrent().getActiveShell()) {
@Override
protected Control createDialogArea(Composite parent) {
return createColumnControlPanel(parent);
}
};
int result = confColsDialog.open();
if (result == Dialog.CANCEL) {
restore();
}
}
use of org.eclipse.jface.dialogs.Dialog in project pentaho-kettle by pentaho.
the class CommonStepDialog method openDialog.
protected void openDialog(final String title, final String message, final int dialogType) {
final Dialog dialog = new SimpleMessageDialog(shell, title, message, dialogType);
dialog.open();
}
Aggregations