List of usage examples for org.eclipse.jface.dialogs Dialog open
public int open()
From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.DialogUtils.java
License:Open Source License
/** * @param element//from ww w . ja va 2 s. c om * @param newMode * @param parent * @return */ public static int openPropertiesDialog(final IWebflowModelElement parent, final IWebflowModelElement element, final boolean newMode, final int index) { final Integer[] result = new Integer[1]; final Shell shell = getShell(); Display.getDefault().syncExec(new Runnable() { public void run() { Dialog dialog = null; if (element instanceof IEndState) { dialog = new EndStatePropertiesDialog(shell, parent, (IEndState) element); } else if (element instanceof IViewState) { dialog = new ViewStatePropertiesDialog(shell, parent, (IViewState) element); } else if (element instanceof ISubflowState) { dialog = new SubFlowStatePropertiesDialog(shell, parent, (ISubflowState) element, index); } else if (element instanceof IActionState) { dialog = new ActionStatePropertiesDialog(shell, parent, (IActionState) element); } else if (element instanceof Action) { dialog = new ActionPropertiesDialog(shell, parent, (Action) element); } else if (element instanceof BeanAction) { dialog = new BeanActionPropertiesDialog(shell, parent, (BeanAction) element); } else if (element instanceof EvaluateAction) { dialog = new EvaluateActionPropertiesDialog(shell, parent, (EvaluateAction) element); } else if (element instanceof Set) { dialog = new SetActionPropertiesDialog(shell, parent, (Set) element); } else if (element instanceof OutputAttribute) { dialog = new InputAttributeEditorDialog(shell, (IOutputAttribute) element); } else if (element instanceof InputAttribute) { dialog = new InputAttributeEditorDialog(shell, (IInputAttribute) element); } else if (element instanceof IMapping) { dialog = new MappingEditorDialog(shell, (IMapping) element); } else if (element instanceof ExceptionHandler) { dialog = new ExceptionHandlerPropertiesDialog(shell, parent, (ExceptionHandler) element); } else if (element instanceof IStateTransition) { dialog = new StateTransitionPropertiesDialog(shell, parent, (IStateTransition) element); } else if (element instanceof IDecisionState) { dialog = new DecisionStatePropertiesDialog(shell, parent, (IDecisionState) element); } else if (element instanceof IIf) { dialog = new IfPropertiesDialog(shell, (IDecisionState) parent, (IIf) element, newMode); } else if (element instanceof IWebflowState) { dialog = new WebflowStatePropertiesDialog(shell, (IWebflowState) element); } if (dialog != null) { dialog.setBlockOnOpen(true); result[0] = dialog.open(); } } }); return result[0]; }
From source file:org.talend.designer.core.ui.action.ParallelExecutionAction.java
License:Open Source License
@Override public void run() { boolean hasFlowConnection = false; for (IConnection connection : node.getOutgoingConnections()) { if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) { hasFlowConnection = true;//from w ww.j a va 2 s.c o m break; } } if (hasFlowConnection) { MessageDialog.openError(getWorkbenchPart().getSite().getShell(), Messages.getString("ParallelExecutionAction.gotLink"), //$NON-NLS-1$ Messages.getString("ParallelExecutionAction.noOutputLink")); //$NON-NLS-1$ return; } IElementParameter enableParallelizeParameter = node .getElementParameter(EParameterName.PARALLELIZE.getName()); if (enableParallelizeParameter != null) { parallelEnable = (Boolean) enableParallelizeParameter.getValue(); } IElementParameter numberParallelizeParameter = node .getElementParameter(EParameterName.PARALLELIZE_NUMBER.getName()); if (numberParallelizeParameter != null) { numberParallel = (String) numberParallelizeParameter.getValue(); } Dialog dialog = new ParallelDialog(getWorkbenchPart().getSite().getShell()); if (dialog.open() == Dialog.OK) { Command command = new PropertyChangeCommand(node, EParameterName.PARALLELIZE.getName(), parallelEnable); execute(command); } }
From source file:org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController.java
License:Open Source License
/** * DOC qzhang Comment method "openSQLBuilder". * //from ww w. j a v a2 s . c o m * @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)) { String repositoryName2 = ""; //$NON-NLS-1$ 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("NoRepositoryDialog.Text")); //$NON-NLS-1$ return null; } // Part maybe not exist String processName = "";//$NON-NLS-1$ String key = "";//$NON-NLS-1$ 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); connParameters.setFirstOpenSqlBuilder(true); // first open Sql Builder,set 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; }
From source file:org.talend.designer.core.ui.editor.properties.controllers.SqlMemoController.java
License:Open Source License
private Command refreshConnectionCommand() { // open sql builder in repository mode, just use query object, no need for connection information ConnectionParameters connParameters = new ConnectionParameters(); String queryId = (String) elem.getPropertyValue(EParameterName.REPOSITORY_QUERYSTORE_TYPE.getName()); Query query = MetadataToolHelper.getQueryFromRepository(queryId); DatabaseConnectionItem item = findRepositoryItem(queryId); if (item != null) { connParameters.setRepositoryName(item.getProperty().getLabel()); connParameters.setRepositoryId(item.getProperty().getId()); }//w ww .j av a2 s . c o m connParameters.setQueryObject(query); connParameters.setQuery(query.getValue()); TextUtil.setDialogTitle(TextUtil.SQL_BUILDER_TITLE_REP); String processName = null; if (elem instanceof IProcess) { processName = ((IProcess) elem).getName(); } else if (elem instanceof INode) { processName = ((INode) elem).getProcess().getName(); } else if (elem instanceof IConnection) { processName = ((IConnection) elem).getSource().getProcess().getName(); } connParameters.setNodeReadOnly(false); connParameters.setFromRepository(true); ISQLBuilderService sqlBuilderService = (ISQLBuilderService) GlobalServiceRegister.getDefault() .getService(ISQLBuilderService.class); Dialog sqlBuilder = sqlBuilderService.openSQLBuilderDialog(composite.getShell(), processName, connParameters); String sql = null; if (Window.OK == sqlBuilder.open()) { sql = connParameters.getQuery(); } if (sql != null && !queryText.isDisposed()) { queryText.setText(sql); String propertyName = (String) openSQLEditorButton.getData(PARAMETER_NAME); return new PropertyChangeCommand(elem, propertyName, sql); } return null; }
From source file:org.talend.designer.esb.webservice.ui.RouteResourceSelectionListener.java
License:Open Source License
@Override protected void buttonSelected(SelectionEvent e) { try {//from w ww . j av a 2s. c o m Class<?> dialogClass = Platform.getBundle("org.talend.camel.designer") .loadClass("org.talend.camel.designer.dialog.RouteResourceSelectionDialog"); Dialog dialog = (Dialog) dialogClass.getConstructor(Shell.class).newInstance(getShell()); if (dialog.open() == Dialog.OK) { RepositoryNode resourceNode = (RepositoryNode) dialogClass.getMethod("getResult").invoke(dialog); if (resourceNode != null) { listener.routeResourceNodeSelected(resourceNode); } } } catch (Exception e1) { ExceptionHandler.process( new IllegalStateException("Can't load RouteResourceSelectionDialog from specific bundle", e1)); } }
From source file:org.talend.designer.neo4j.Neo4jComponent.java
License:Open Source License
@Override public int open(Composite parent) { initNeo4jMain();//w ww. j a v a2s . c o m neo4jMain.createModelFromExternalData(getIODataComponents(), getMetadataList(), externalData, true); Dialog dialog = neo4jMain.createNeo4jDialog(parent.getShell()); dialog.open(); return neo4jMain.getMapperDialogResponse(); }
From source file:org.talend.designer.rowgenerator.RowGeneratorComponent.java
License:Open Source License
@Override public int open(final Composite parent) { initRowGeneratorMain();/*from w w w. j a v a 2 s .c om*/ rowGeneratorMain.createModelFromExternalData(getIODataComponents(), getMetadataList(), externalData, true); Dialog dialog = rowGeneratorMain.createRowGeneratorDialog(parent.getShell()); dialog.open(); return rowGeneratorMain.getMapperDialogResponse(); }
From source file:org.talend.repository.ui.actions.AContextualAction.java
License:Open Source License
/** * Display a prompt dialog to ask the user if we should save the job before duplicating. * //ww w .ja v a2s. c om * @param part * @return */ protected int promptForSavingDialog(IEditorPart part) { String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; // String message = NLS.bind(WorkbenchMessages.EditorManager_saveChangesQuestion, part.getTitle()); String message = Messages.getString("AContextualAction.EditorManager_saveChangesQuestion", //$NON-NLS-1$ new Object[] { part.getTitle() }); // Dialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), WorkbenchMessages.Save_Resource, // null, message, // MessageDialog.QUESTION, buttons, 0) { Dialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.getString("AContextualAction.Save_Resource"), null, message, //$NON-NLS-1$ MessageDialog.QUESTION, buttons, 0) { @Override protected int getShellStyle() { return SWT.NONE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | getDefaultOrientation(); } }; return dialog.open(); }
From source file:org.talend.repository.ui.wizards.metadata.table.database.DatabaseTableFilterForm.java
License:Open Source License
/** * addButtonControls./*w w w .ja v a 2 s .c o m*/ * */ @Override protected void addUtilsButtonListeners() { tableCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getTableInfoParameters().changeType(ETableTypes.TABLETYPE_TABLE, tableCheck.getSelection()); // Added by Marvin Wang on Feb. 5, 2012 for bug TDI-24413, in fact the type is added here is not a good // way. // Suggestion: We could abstract the TableInfoParameters as a reference in DatabaseTableWizardPage. Each // child like "HiveTableInfoParameters" could implement "getTypes()" to return the private types. When // types are reqired, it could invoke like // "DatabaseTableWizardPage.getTableInfoParameters().getTypes()". getTableInfoParameters().changeType(ETableTypes.TABLETYPE_EXTERNAL_TABLE, tableCheck.getSelection()); getTableInfoParameters().changeType(ETableTypes.EXTERNAL_TABLE, tableCheck.getSelection()); getTableInfoParameters().changeType(ETableTypes.MANAGED_TABLE, tableCheck.getSelection()); getTableInfoParameters().changeType(ETableTypes.INDEX_TABLE, tableCheck.getSelection()); } }); viewCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getTableInfoParameters().changeType(ETableTypes.TABLETYPE_VIEW, viewCheck.getSelection()); getTableInfoParameters().changeType(ETableTypes.VIRTUAL_VIEW, viewCheck.getSelection()); } }); synonymCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getTableInfoParameters().changeType(ETableTypes.TABLETYPE_SYNONYM, synonymCheck.getSelection()); } }); // hide for the bug 7959 if (isOracle()) { publicSynonymCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getTableInfoParameters().changeType(ETableTypes.TABLETYPE_ALL_SYNONYM, publicSynonymCheck.getSelection()); ExtractMetaDataUtils.getInstance().setUseAllSynonyms(publicSynonymCheck.getSelection()); if (publicSynonymCheck.getSelection()) { tableCheck.setEnabled(false); viewCheck.setEnabled(false); synonymCheck.setEnabled(false); } else { tableCheck.setEnabled(true); viewCheck.setEnabled(true); synonymCheck.setEnabled(true); } } }); } SelectionAdapter selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { addName = ""; //$NON-NLS-1$ Dialog dialog = new Dialog(getShell()) { Text addText; @Override protected Control createDialogArea(Composite parent) { Composite createDialogArea = (Composite) super.createDialogArea(parent); Label addLabel = new Label(createDialogArea, SWT.NONE); addLabel.setText(Messages.getString("DatabaseTableFilterForm.filterName")); //$NON-NLS-1$ addText = new Text(createDialogArea, SWT.BORDER); GridData gridData = new GridData(GridData.FILL_BOTH); addText.setLayoutData(gridData); addText.setText(addName); return createDialogArea; } /* * (non-Javadoc) * * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.getString("DatabaseTableFilterForm.newFilterName")); //$NON-NLS-1$ } /* * (non-Javadoc) * * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ @Override protected void okPressed() { addName = addText.getText(); super.okPressed(); } }; if (dialog.open() == Dialog.OK) { nameFilter.add(addName, 0); nameFilter.select(0); removeButton.setEnabled(true); editButton.setEnabled(true); } } }; newButton.addSelectionListener(selectionAdapter); selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final int index = nameFilter.getSelectionIndex(); if (nameFilter.getSelection().length > 0) { addName = nameFilter.getSelection()[0]; } Dialog dialog = new Dialog(getShell()) { Text addText; @Override protected Control createDialogArea(Composite parent) { Composite createDialogArea = (Composite) super.createDialogArea(parent); Label addLabel = new Label(createDialogArea, SWT.NONE); addLabel.setText(Messages.getString("DatabaseTableFilterForm.filterName")); //$NON-NLS-1$ addText = new Text(createDialogArea, SWT.BORDER); GridData gridData = new GridData(GridData.FILL_BOTH); addText.setLayoutData(gridData); addText.setText(addName); return createDialogArea; } /* * (non-Javadoc) * * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.getString("DatabaseTableFilterForm.editFilterName")); //$NON-NLS-1$ } /* * (non-Javadoc) * * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ @Override protected void okPressed() { addName = addText.getText(); super.okPressed(); } }; if (dialog.open() == Dialog.OK) { nameFilter.setItem(index, addName); nameFilter.select(index); } } }; editButton.addSelectionListener(selectionAdapter); selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (nameFilter.getSelection().length > 0) { addName = nameFilter.getSelection()[0]; nameFilter.remove(addName); } } }; removeButton.addSelectionListener(selectionAdapter); }
From source file:org.tencompetence.ldauthor.opendock.ui.SearchResultsTreeViewer.java
License:Open Source License
/** * View the Selected Item//from w w w . ja va 2s.c o m */ @SuppressWarnings("unchecked") private void doViewSelectedItem() { Object selected = ((IStructuredSelection) getSelection()).getFirstElement(); if (selected instanceof HashMap) { ArrayList<HashMap<String, String>> list = (ArrayList<HashMap<String, String>>) getInput(); Dialog dlg = new UoLDetailsDialog(getControl().getShell(), list, (HashMap<String, String>) selected); dlg.open(); } }