use of org.eclipse.core.runtime.IStatus in project tdi-studio-se by Talend.
the class NameSection method createControls.
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
composite = getWidgetFactory().createFlatFormComposite(parent);
FormData data;
//$NON-NLS-1$
nameText = getWidgetFactory().createText(composite, "");
data = new FormData();
data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
data.right = new FormAttachment(50, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
nameText.setLayoutData(data);
addFocusListener(nameText);
nameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
IStatus status = evaluateTextField();
if (status.getSeverity() == IStatus.ERROR) {
errorLabel.setText(status.getMessage());
errorLabel.setVisible(true);
} else {
errorLabel.setVisible(false);
}
}
});
//$NON-NLS-1$
CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("NameSection.Name"));
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(nameText, -ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(nameText, 0, SWT.CENTER);
labelLabel.setLayoutData(data);
//$NON-NLS-1$
errorLabel = getWidgetFactory().createCLabel(composite, "");
data = new FormData();
data.left = new FormAttachment(nameText, ITabbedPropertyConstants.HSPACE * 3);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(nameText, 0, SWT.CENTER);
errorLabel.setLayoutData(data);
errorLabel.setImage(ImageProvider.getImage(EImage.ERROR_ICON));
errorLabel.setVisible(false);
addFocusListenerToChildren(composite);
}
use of org.eclipse.core.runtime.IStatus in project tdi-studio-se by Talend.
the class NameSection method beforeSave.
@Override
protected void beforeSave() {
IStatus status = evaluateTextField();
if (status.getSeverity() != IStatus.ERROR) {
String text = nameText.getText();
if (!text.equals(getObject().getLabel())) {
if (getType() == ERepositoryObjectType.FOLDER) {
IPath path = RepositoryNodeUtilities.getPath(getNode());
try {
ERepositoryObjectType type = getNode().getContentType();
getRepositoryFactory().renameFolder(type, path, text);
// TDI-21143 : Studio repository view : remove all refresh call to repo view
// IRepositoryView view = RepositoryManagerHelper.findRepositoryView();
// if (view != null) {
// view.refresh();
// }
} catch (PersistenceException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
return;
}
}
// getObject().setLabel(text);
}
}
}
use of org.eclipse.core.runtime.IStatus in project tdi-studio-se by Talend.
the class NewImportProjectWizardPage method updatePageStatus.
private void updatePageStatus() {
IStatus findMostSevere = findMostSevere();
setMessage(findMostSevere);
setPageComplete(findMostSevere.getSeverity() != IStatus.ERROR);
}
use of org.eclipse.core.runtime.IStatus in project tdi-studio-se by Talend.
the class NewImportProjectWizardPage method findMostSevere.
private IStatus findMostSevere() {
IStatus status;
if (nameStatus.getSeverity() == IStatus.ERROR) {
status = nameStatus;
} else if (descriptionStatus.getSeverity() == IStatus.ERROR) {
status = descriptionStatus;
} else if (languageStatus.getSeverity() == IStatus.ERROR) {
status = languageStatus;
} else {
status = nameStatus.getSeverity() > descriptionStatus.getSeverity() ? nameStatus : descriptionStatus;
status = status.getSeverity() > languageStatus.getSeverity() ? status : languageStatus;
}
return status;
}
use of org.eclipse.core.runtime.IStatus in project tdi-studio-se by Talend.
the class ImportProjectAsWizardPage method updatePageStatus.
private void updatePageStatus() {
IStatus findMostSevere = findMostSevere();
setMessage(findMostSevere);
setPageComplete(findMostSevere.getSeverity() != IStatus.ERROR);
}
Aggregations