Search in sources :

Example 41 with IStatus

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);
}
Also used : FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) ModifyEvent(org.eclipse.swt.events.ModifyEvent) IStatus(org.eclipse.core.runtime.IStatus) ModifyListener(org.eclipse.swt.events.ModifyListener) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 42 with IStatus

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);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IPath(org.eclipse.core.runtime.IPath) PersistenceException(org.talend.commons.exception.PersistenceException) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 43 with IStatus

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);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus)

Example 44 with IStatus

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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus)

Example 45 with IStatus

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);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus)

Aggregations

IStatus (org.eclipse.core.runtime.IStatus)417 Status (org.eclipse.core.runtime.Status)195 CoreException (org.eclipse.core.runtime.CoreException)103 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)81 IOException (java.io.IOException)48 ArrayList (java.util.ArrayList)46 File (java.io.File)40 InvocationTargetException (java.lang.reflect.InvocationTargetException)39 ITask (com.cubrid.common.core.task.ITask)37 Job (org.eclipse.core.runtime.jobs.Job)32 IFile (org.eclipse.core.resources.IFile)31 TaskJobExecutor (com.cubrid.common.ui.spi.progress.TaskJobExecutor)29 IPath (org.eclipse.core.runtime.IPath)29 List (java.util.List)23 IResource (org.eclipse.core.resources.IResource)22 MultiStatus (org.eclipse.core.runtime.MultiStatus)22 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)19 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)19 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)18 InputStream (java.io.InputStream)17