use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.
the class ComponentProjectPreferencePage method propertyChange.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.preference.FieldEditorPreferencePage#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
super.propertyChange(event);
MessageDialog warningMessageDialog = new MessageDialog(getFieldEditorParent().getShell(), //$NON-NLS-1$
Messages.getString("ComponentProjectPreferencePage.Warning"), //$NON-NLS-1$
null, //$NON-NLS-1$
Messages.getString("ComponentProjectPreferencePage.WarningMSG"), //$NON-NLS-1$
MessageDialog.WARNING, new String[] { Messages.getString("ComponentProjectPreferencePage.ButtonLabel0") }, //$NON-NLS-1$
0);
warningMessageDialog.open();
}
use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.
the class ImportDemoProjectItemsPage method performFinish.
public boolean performFinish() {
List<DemoProjectBean> checkedElements = getCheckedElements();
final List<ResourcesManager> finalCheckManagers = getResourceManagers(checkedElements);
String warnMessage = populateExistItemRecords(finalCheckManagers);
if (!warnMessage.equals("")) {
MessageDialog dialog = new MessageDialog(getShell(), Messages.getString("ImportDemoProjectPage.overwrite"), null, warnMessage, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
dialog.open();
int result = dialog.getReturnCode();
if (result != MessageDialog.OK) {
return false;
}
}
ProgressDialog progressDialog = new ProgressDialog(getShell()) {
private IProgressMonitor monitorWrap;
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitorWrap = new EventLoopProgressMonitor(monitor);
try {
for (ResourcesManager resManager : finalCheckManagers) {
List<ImportItem> projectRecords = importManager.populateImportingItems(resManager, true, monitorWrap);
// clearOverWriteErrorMessages(projectRecords, overwrite);
importManager.importItemRecords(monitorWrap, resManager, projectRecords, true, projectRecords.toArray(new ImportItem[0]), null);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
monitorWrap.done();
if (monitor.isCanceled()) {
MessageDialog.openInformation(getShell(), Messages.getString("ImportDemoProjectAction.messageDialogTitle.demoProjectCancel"), Messages.getString("ImportDemoProjectAction.messageDialogContent.demoProjectImportedIncompletely"));
return;
} else {
MessageDialog.openInformation(getShell(), //$NON-NLS-1$
Messages.getString("ImportDemoProjectAction.messageDialogTitle.demoProject"), //$NON-NLS-1$
Messages.getString("ImportDemoProjectAction.messageDialogContent.demoProjectImportedSuccessfully"));
}
}
};
try {
progressDialog.executeProcess();
} catch (InvocationTargetException e) {
MessageBoxExceptionHandler.process(e.getTargetException(), getShell());
} catch (InterruptedException e) {
// Nothing to do
}
return true;
}
use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.
the class PaletteSettingPage method setComponentVisible.
/**
* set the selected component as visible or not
*
* @param selection
* @param b
*/
protected void setComponentVisible(ISelection selection, boolean visible) {
IStructuredSelection sel = (IStructuredSelection) selection;
Set<IPaletteItem> items = new HashSet<IPaletteItem>();
for (Iterator iterator = sel.iterator(); iterator.hasNext(); ) {
IPaletteItem entry = (IPaletteItem) iterator.next();
retrieveAllEntry(items, entry);
}
Set<IComponent> usedComponents = getComponentsUsedInProject(ProjectManager.getInstance().getCurrentProject());
boolean isUsed = false;
for (IPaletteItem item : items) {
if (!visible && item instanceof ComponentPaletteItem) {
if (usedComponents.contains(((ComponentPaletteItem) item).getComponent())) {
isUsed = true;
continue;
}
}
setComponentVisible(item, visible);
}
if (isUsed) {
MessageDialog messageDialog = new MessageDialog(getShell(), //$NON-NLS-1$
Messages.getString("PaletteSettingPage.paletteSettings"), //$NON-NLS-1$
null, //$NON-NLS-1$ //$NON-NLS-2$
Messages.getString("PaletteSettingPage.selection1") + "\n" + //$NON-NLS-1$
Messages.getString("PaletteSettingPage.selection2"), //$NON-NLS-1$
MessageDialog.INFORMATION, new String[] { "OK" }, //$NON-NLS-1$
0);
messageDialog.open();
}
refreshViewer();
}
use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.
the class EditQueriesAction method doRun.
@Override
protected void doRun() {
IStructuredSelection selection = (IStructuredSelection) getSelection();
if (repositoryNode == null && selection != null) {
repositoryNode = (RepositoryNode) selection.getFirstElement();
}
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
IRepositoryViewObject nodeObject = repositoryNode.getObject();
boolean locked = false;
if (!factory.getRepositoryContext().isEditableAsReadOnly()) {
if (nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_OTHER) {
locked = true;
}
}
// Avoid to delete node which is locked.
if (locked || RepositoryManager.isOpenedItemInEditor(nodeObject)) {
final String title = "Impossible to edit queries";
String nodeName = nodeObject.getRepositoryObjectType().getLabel();
final String message = "item is already locked by another user.";
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
MessageDialog dialog = new MessageDialog(new Shell(), title, null, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);
dialog.open();
}
});
return;
}
DatabaseConnectionItem dbConnectionItem = null;
boolean readOnly = false;
ConnectionParameters connParameters = new ConnectionParameters();
if (repositoryNode.getObjectType() == ERepositoryObjectType.METADATA_CONNECTIONS) {
dbConnectionItem = (DatabaseConnectionItem) repositoryNode.getObject().getProperty().getItem();
connParameters.setRepositoryName(repositoryNode.getObject().getLabel());
connParameters.setRepositoryId(repositoryNode.getObject().getId());
//$NON-NLS-1$
connParameters.setQuery("");
} else if (repositoryNode.getObjectType() == ERepositoryObjectType.METADATA_CON_QUERY) {
QueryRepositoryObject queryRepositoryObject = (QueryRepositoryObject) repositoryNode.getObject();
readOnly = SubItemHelper.isDeleted(queryRepositoryObject.getAbstractMetadataObject());
dbConnectionItem = (DatabaseConnectionItem) queryRepositoryObject.getProperty().getItem();
connParameters.setRepositoryName(dbConnectionItem.getProperty().getLabel());
connParameters.setRepositoryId(dbConnectionItem.getProperty().getId());
connParameters.setQueryObject(queryRepositoryObject.getQuery());
connParameters.setQuery(queryRepositoryObject.getQuery().getValue());
// first open Sql Builder,set true
connParameters.setFirstOpenSqlBuilder(true);
} else if (repositoryNode.getObjectType() == ERepositoryObjectType.METADATA_CON_TABLE) {
dbConnectionItem = (DatabaseConnectionItem) repositoryNode.getObject().getProperty().getItem();
connParameters.setRepositoryName(dbConnectionItem.getProperty().getLabel());
connParameters.setRepositoryId(dbConnectionItem.getProperty().getId());
connParameters.setMetadataTable((MetadataTableRepositoryObject) repositoryNode.getObject());
//$NON-NLS-1$
connParameters.setQuery("");
}
IRepositoryView viewPart = getViewPart();
Display display = null;
if (viewPart != null) {
display = viewPart.getViewer().getControl().getDisplay();
} else {
display = Display.getCurrent();
if (display == null) {
display = Display.getDefault();
}
}
Shell parentShell = new Shell(display);
TextUtil.setDialogTitle(TextUtil.SQL_BUILDER_TITLE_REP);
Connection connection = dbConnectionItem.getConnection();
String selectedContext = null;
if (connection.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(connection.getContextId());
if (contextItem != null && connection.isContextMode()) {
ContextSetsSelectionDialog setsDialog = new ContextSetsSelectionDialog(null, contextItem, false);
setsDialog.open();
selectedContext = setsDialog.getSelectedContext();
}
}
SQLBuilderDialog dial = new SQLBuilderDialog(parentShell, repositoryNode, selectedContext);
dial.setReadOnly(readOnly);
if (connection instanceof DatabaseConnection) {
IMetadataConnection imetadataConnection = ConvertionHelper.convert(connection, true);
connParameters.setSchema(imetadataConnection.getSchema() == null ? "" : imetadataConnection.getSchema());
UIUtils.checkConnection(parentShell, imetadataConnection);
}
connParameters.setNodeReadOnly(readOnly);
connParameters.setFromRepository(true);
dial.setConnParameters(connParameters);
dial.open();
IRepositoryView view = getViewPart();
if (view != null) {
view.refreshView();
}
}
use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.
the class JobletContainer method setPropertyValue.
@Override
public void setPropertyValue(String id, Object value) {
if (id.equals(EParameterName.COLLAPSED.getName())) {
// outputs.clear();
for (IConnection conn : node.getOutgoingConnections()) {
outputs.add(conn);
}
// inputs.clear();
for (IConnection conn : node.getIncomingConnections()) {
inputs.add(conn);
}
if (needchangeLock) {
if (!((Boolean) value)) {
if (!new JobletUtil().isRed(this)) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (service != null) {
service.lockJoblet(this.getNode());
}
}
} else {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (service != null) {
service.unlockJoblet(node, true);
}
}
}
needchangeLock = true;
refreshJobletNodes(false, (Boolean) value);
if (!canCollapse()) {
Shell shell = Display.getCurrent().getActiveShell();
MessageDialog dlg = new MessageDialog(new Shell(shell), "ERROR", null, "Please attach connection correctly!", MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
dlg.open();
return;
}
super.setPropertyValue(id, value);
transferLocation(false);
updateJobletContainer();
if (node.isJoblet()) {
refreshJobletConnections();
}
fireStructureChange(EParameterName.COLLAPSED.getName(), this);
} else if (id.equals(UPDATE_JOBLET_DISPLAY)) {
updateJobletDisplay();
} else {
super.setPropertyValue(id, value);
}
}
Aggregations