Program: 118102
Project: 118102
Buggy source:
/** 
 * yzhang MainComposite constructor comment.
 * @param parent
 * @param style
 */
public MainComposite(Composite parent,int style,TabbedPropertySheetWidgetFactory factory,IRepositoryViewObject obj){
  super(parent,style,factory,obj);
  IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
  boolean allowVerchange=brandingService.getBrandingConfiguration().isAllowChengeVersion();
  allowEnableControl=false;
  enableControl=false;
  String framework=null;
  if (obj instanceof RepositoryViewObject || obj instanceof IProcess2) {
    if (obj instanceof RepositoryViewObject) {
      framework=((RepositoryViewObject)obj).getFramework();
    }
 else {
      framework=(String)((IProcess2)obj).getAdditionalProperties().get(ConvertJobsUtil.FRAMEWORK);
    }
    if (ERepositoryObjectType.getAllTypesOfProcess().contains(repositoryObject.getRepositoryObjectType())) {
      allowEnableControl=true;
      enableControl=true;
      if (!PluginChecker.isMapReducePluginLoader() && !PluginChecker.isStormPluginLoader()) {
        allowEnableControl=false;
      }
      Item originalItem=repositoryObject.getProperty().getItem();
      if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
        ICamelDesignerCoreService camelService=(ICamelDesignerCoreService)GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
        if (camelService != null && camelService.isInstanceofCamel(originalItem)) {
          allowEnableControl=false;
          enableControl=false;
        }
      }
    }
  }
  FormLayout layout=new FormLayout();
  setLayout(layout);
  FormData thisFormData=new FormData();
  thisFormData.left=new FormAttachment(0,0);
  thisFormData.right=new FormAttachment(100,0);
  thisFormData.top=new FormAttachment(0,0);
  thisFormData.bottom=new FormAttachment(100,0);
  setLayoutData(thisFormData);
  Composite composite=widgetFactory.createFlatFormComposite(this);
  FormData compositeData=new FormData();
  compositeData.left=new FormAttachment(0,0);
  compositeData.right=new FormAttachment(100,0);
  compositeData.top=new FormAttachment(0,0);
  compositeData.bottom=new FormAttachment(100,0);
  composite.setLayoutData(thisFormData);
  nameText=widgetFactory.createText(composite,"String_Node_Str");
  FormData data=new FormData();
  data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  data.right=new FormAttachment(50,0);
  data.top=new FormAttachment(0,ITabbedPropertyConstants.VSPACE);
  nameText.setLayoutData(data);
  String nameContent=repositoryObject.getLabel();
  nameText.setText(nameContent != null ? nameContent : "String_Node_Str");
  nameText.setEnabled(allowEnableControl);
  nameTextDecorator=new ControlDecoration(nameText,SWT.TOP | SWT.RIGHT);
  FieldDecoration fieldDecoration=FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
  nameTextDecorator.setImage(fieldDecoration.getImage());
  nameTextDecorator.hide();
  CLabel nameLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(nameText,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(nameText,0,SWT.CENTER);
  nameLabel.setLayoutData(data);
  Text authorText=widgetFactory.createText(composite,"String_Node_Str");
  authorText.setEnabled(false);
  data=new FormData();
  data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  data.right=new FormAttachment(50,0);
  data.top=new FormAttachment(nameLabel,ITabbedPropertyConstants.VSPACE);
  authorText.setLayoutData(data);
  User user=repositoryObject.getAuthor();
  if (user != null) {
    String author=user.getLogin();
    authorText.setText(author != null ? author : "String_Node_Str");
  }
 else {
    authorText.setText(nameContent);
  }
  authorText.setEnabled(false);
  CLabel authorLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(authorText,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(authorText,0,SWT.CENTER);
  authorLabel.setLayoutData(data);
  if (allowVerchange) {
    btnDown=widgetFactory.createButton(composite,"String_Node_Str",SWT.PUSH);
    data=new FormData();
    data.right=new FormAttachment(100,0);
    data.top=new FormAttachment(authorText,0,SWT.CENTER);
    btnDown.setLayoutData(data);
    btnDown.setEnabled(allowEnableControl);
    btnUp=widgetFactory.createButton(composite,"String_Node_Str",SWT.PUSH);
    data=new FormData();
    data.right=new FormAttachment(btnDown,0);
    data.top=new FormAttachment(authorText,0,SWT.CENTER);
    btnUp.setLayoutData(data);
    btnUp.setEnabled(allowEnableControl);
    versionText=widgetFactory.createText(composite,"String_Node_Str");
    data=new FormData();
    data.left=new FormAttachment(authorText,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(btnUp,-2);
    data.top=new FormAttachment(authorText,0,SWT.CENTER);
    versionText.setLayoutData(data);
    String version=repositoryObject.getVersion();
    versionText.setText(version != null ? version : "String_Node_Str");
    versionText.setEditable(false);
    CLabel versionLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
    data=new FormData();
    data.left=new FormAttachment(authorText,ITabbedPropertyConstants.HSPACE * 3);
    data.right=new FormAttachment(versionText,-ITabbedPropertyConstants.HSPACE);
    data.top=new FormAttachment(versionText,0,SWT.CENTER);
    versionLabel.setLayoutData(data);
  }
  Text creationDate=widgetFactory.createText(composite,"String_Node_Str");
  data=new FormData();
  data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  data.right=new FormAttachment(50,0);
  data.top=new FormAttachment(authorLabel,ITabbedPropertyConstants.VSPACE);
  creationDate.setLayoutData(data);
  creationDate.setEnabled(false);
  Date cDate=repositoryObject.getCreationDate();
  creationDate.setText(cDate != null ? FORMATTER.format(cDate) : "String_Node_Str");
  creationDate.setEnabled(enableControl);
  CLabel creationLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(creationDate,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(creationDate,0,SWT.CENTER);
  creationLabel.setLayoutData(data);
  Text modificationDate=widgetFactory.createText(composite,"String_Node_Str");
  data=new FormData();
  data.left=new FormAttachment(creationDate,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  data.right=new FormAttachment(100,0);
  data.top=new FormAttachment(authorLabel,ITabbedPropertyConstants.VSPACE);
  modificationDate.setLayoutData(data);
  modificationDate.setEnabled(false);
  Date mDate=repositoryObject.getModificationDate();
  modificationDate.setText(mDate != null ? FORMATTER.format(mDate) : "String_Node_Str");
  modificationDate.setEnabled(enableControl);
  CLabel modificationLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(creationDate,ITabbedPropertyConstants.HSPACE - 10);
  data.right=new FormAttachment(modificationDate,ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(modificationDate,0,SWT.CENTER);
  modificationLabel.setLayoutData(data);
  final Map<String,String> statusMap=getStatusMap();
  if (allowEnableControl) {
    jobTypeCCombo=widgetFactory.createCCombo(composite,SWT.READ_ONLY | SWT.DROP_DOWN);
    data=new FormData();
    data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(50,0);
    data.top=new FormAttachment(creationDate,ITabbedPropertyConstants.VSPACE);
    jobTypeCCombo.setLayoutData(data);
    jobTypeCCombo.setItems(JobType.getJobTypeToDispaly());
    String jobType=ConvertJobsUtil.getJobTypeFromFramework(framework);
    jobTypeCCombo.setText(jobType);
    jobTypeValue=jobTypeCCombo.getText();
    jobTypeCCombo.setEnabled(allowEnableControl);
    String type=Messages.getString("String_Node_Str");
    if (obj.getProperty().getItem() instanceof JobletProcessItem) {
      type=Messages.getString("String_Node_Str");
    }
    CLabel jobTypeLabel=widgetFactory.createCLabel(composite,type);
    data=new FormData();
    data.left=new FormAttachment(0,0);
    data.right=new FormAttachment(jobTypeCCombo,-ITabbedPropertyConstants.HSPACE);
    data.top=new FormAttachment(jobTypeCCombo,0,SWT.CENTER);
    jobTypeLabel.setLayoutData(data);
    jobFrameworkCCombo=widgetFactory.createCCombo(composite,SWT.READ_ONLY | SWT.DROP_DOWN);
    data=new FormData();
    data.left=new FormAttachment(jobTypeCCombo,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(100,0);
    data.top=new FormAttachment(creationDate,ITabbedPropertyConstants.VSPACE);
    jobFrameworkCCombo.setLayoutData(data);
    jobFrameworkCCombo.setItems(ConvertJobsUtil.getFrameworkItemsByJobType(jobType,(obj.getProperty().getItem() instanceof JobletProcessItem)));
    jobFrameworkCCombo.setText(framework != null ? framework : "String_Node_Str");
    frameworkValue=jobFrameworkCCombo.getText();
    jobFrameworkCCombo.setEnabled(allowEnableControl);
    CLabel jobFrameworkLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
    data=new FormData();
    data.left=new FormAttachment(jobTypeCCombo,ITabbedPropertyConstants.HSPACE - 10);
    data.right=new FormAttachment(jobFrameworkCCombo,ITabbedPropertyConstants.HSPACE + 1);
    data.top=new FormAttachment(jobFrameworkCCombo,0,SWT.CENTER);
    jobFrameworkLabel.setLayoutData(data);
    purposeText=widgetFactory.createText(composite,"String_Node_Str");
    data=new FormData();
    data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(50,0);
    data.top=new FormAttachment(jobTypeLabel,ITabbedPropertyConstants.VSPACE);
    purposeText.setLayoutData(data);
    String content=repositoryObject.getPurpose();
    purposeText.setText(content != null ? content : "String_Node_Str");
    purposeText.setEnabled(allowEnableControl);
    CLabel purposeLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
    data=new FormData();
    data.left=new FormAttachment(0,0);
    data.right=new FormAttachment(purposeText,-ITabbedPropertyConstants.HSPACE);
    data.top=new FormAttachment(purposeText,0,SWT.CENTER);
    purposeLabel.setLayoutData(data);
    statusText=widgetFactory.createCCombo(composite,SWT.READ_ONLY | SWT.BORDER);
    data=new FormData();
    data.left=new FormAttachment(purposeText,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(100,0);
    data.top=new FormAttachment(jobTypeLabel,ITabbedPropertyConstants.VSPACE);
    statusText.setLayoutData(data);
    String status=repositoryObject.getStatusCode();
    statusText.setText(status != null ? status : "String_Node_Str");
    statusText.setItems(Status.getStatusToDispaly());
    statusLabelText=statusMap.get(status);
    setStatusComboText(statusLabelText);
    statusText.setEnabled(allowEnableControl);
  }
 else {
    purposeText=widgetFactory.createText(composite,"String_Node_Str");
    data=new FormData();
    data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(50,0);
    data.top=new FormAttachment(creationDate,ITabbedPropertyConstants.VSPACE);
    purposeText.setLayoutData(data);
    String content=repositoryObject.getPurpose();
    purposeText.setText(content != null ? content : "String_Node_Str");
    purposeText.setEnabled(enableControl);
    CLabel purposeLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
    data=new FormData();
    data.left=new FormAttachment(0,0);
    data.right=new FormAttachment(purposeText,-ITabbedPropertyConstants.HSPACE);
    data.top=new FormAttachment(purposeText,0,SWT.CENTER);
    purposeLabel.setLayoutData(data);
    statusText=widgetFactory.createCCombo(composite,SWT.READ_ONLY | SWT.BORDER);
    data=new FormData();
    data.left=new FormAttachment(purposeText,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(100,0);
    data.top=new FormAttachment(creationDate,ITabbedPropertyConstants.VSPACE);
    statusText.setLayoutData(data);
    String status=repositoryObject.getStatusCode();
    statusText.setText(status != null ? status : "String_Node_Str");
    statusLabelText=statusMap.get(status);
    setStatusComboText(statusLabelText);
    statusText.setEnabled(enableControl);
  }
  CLabel statusLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(purposeText,ITabbedPropertyConstants.HSPACE * 3);
  data.right=new FormAttachment(statusText,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(statusText,0,SWT.CENTER);
  statusLabel.setLayoutData(data);
  statusText.setItems(Status.getStatusToDispaly());
  String status=repositoryObject.getStatusCode();
  statusLabelText=statusMap.get(status);
  setStatusComboText(statusLabelText);
  descriptionText=widgetFactory.createText(composite,"String_Node_Str",SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
  FormData descriptionData=new FormData();
  descriptionData.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  descriptionData.right=new FormAttachment(100,0);
  descriptionData.top=new FormAttachment(statusText,ITabbedPropertyConstants.VSPACE);
  descriptionData.height=NB_LINES * descriptionText.getLineHeight();
  descriptionText.setLayoutData(descriptionData);
  if (!allowEnableControl) {
    descriptionData.bottom=new FormAttachment(100);
  }
  String description=repositoryObject.getDescription();
  descriptionText.setText(description != null ? description : "String_Node_Str");
  descriptionText.setEnabled(true);
  descriptionText.setEditable(allowEnableControl);
  CLabel descriptionLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(descriptionText,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(descriptionText,0,SWT.TOP);
  descriptionLabel.setLayoutData(data);
  if (allowEnableControl) {
    btnConfirm=widgetFactory.createButton(composite,"String_Node_Str",SWT.PUSH);
    descriptionData.bottom=new FormAttachment(btnConfirm,0,SWT.TOP);
    data=new FormData();
    data.right=new FormAttachment(descriptionText,ITabbedPropertyConstants.HSPACE - 1,SWT.RIGHT);
    data.bottom=new FormAttachment(100);
    btnConfirm.setLayoutData(data);
    btnConfirm.setEnabled(false);
    nameText.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    jobTypeCCombo.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        ConvertJobsUtil.updateJobFrameworkPart(jobTypeCCombo.getText(),jobFrameworkCCombo,(obj.getProperty().getItem() instanceof JobletProcessItem));
        evaluateTextField();
      }
    }
);
    jobFrameworkCCombo.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    purposeText.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    statusText.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    descriptionText.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    if (allowVerchange) {
      btnUp.addSelectionListener(new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          String version=repositoryObject.getVersion();
          if (lastVersionFound != null && VersionUtils.compareTo(lastVersionFound,version) > 0) {
            version=lastVersionFound;
          }
          version=VersionUtils.upMajor(version);
          versionText.setText(version);
          lastVersionFound=version;
          evaluateTextField();
        }
      }
);
      btnDown.addSelectionListener(new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          String version=repositoryObject.getVersion();
          if (lastVersionFound != null && VersionUtils.compareTo(lastVersionFound,version) > 0) {
            version=lastVersionFound;
          }
          version=VersionUtils.upMinor(version);
          versionText.setText(version);
          lastVersionFound=version;
          evaluateTextField();
        }
      }
);
      btnConfirm.addSelectionListener(new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          final IProxyRepositoryFactory proxyRepositoryFactory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
          Property property=repositoryObject.getProperty();
          if (nameText == null || nameText.isDisposed() || versionText == null || versionText.isDisposed() || purposeText == null || purposeText.isDisposed() || jobTypeCCombo == null || jobTypeCCombo.isDisposed() || jobFrameworkCCombo == null || jobFrameworkCCombo.isDisposed() || statusText == null || statusText.isDisposed() || descriptionText == null || descriptionText.isDisposed() || btnConfirm == null || btnConfirm.isDisposed() || property == null) {
            return;
          }
          String originalName=nameText.getText();
          String originalJobType=jobTypeCCombo.getText();
          String originalFramework=jobFrameworkCCombo.getText();
          String originalversion=versionText.getText();
          String originalPurpose=purposeText.getText();
          String originalStatus=statusText.getText();
          String originalDescription=descriptionText.getText();
          saveJobEditor(repositoryObject);
          if (repositoryObject instanceof IProcess2) {
            IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
              @Override public void run(              final IProgressMonitor monitor) throws CoreException {
                DeleteActionCache.getInstance().closeOpenedEditor(repositoryObject);
              }
            }
;
            IWorkspace workspace=ResourcesPlugin.getWorkspace();
            try {
              ISchedulingRule schedulingRule=workspace.getRoot();
              workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
            }
 catch (            CoreException e1) {
              MessageBoxExceptionHandler.process(e1.getCause());
            }
          }
          String newJobName=null;
          if (!originalName.equals(StringUtils.trimToEmpty(repositoryObject.getLabel()))) {
            newJobName=originalName;
          }
          if (!originalversion.equals(StringUtils.trimToEmpty(repositoryObject.getVersion()))) {
            property.setVersion(originalversion);
          }
          if (!originalPurpose.equals(StringUtils.trimToEmpty(repositoryObject.getPurpose()))) {
            property.setPurpose(originalPurpose);
          }
          if (!originalStatus.equals(StringUtils.trimToEmpty(repositoryObject.getStatusCode()))) {
            property.setStatusCode(getStatusCode(statusMap,originalStatus));
          }
          if (!originalDescription.equals(StringUtils.trimToEmpty(repositoryObject.getDescription()))) {
            property.setDescription(originalDescription);
          }
          Item originalItem=repositoryObject.getProperty().getItem();
          if (ConvertJobsUtil.isNeedConvert(originalItem,originalJobType,originalFramework,true)) {
            boolean hasTestCase=ConvertJobsUtil.hasTestCase(repositoryObject.getProperty());
            if (hasTestCase && !MessageDialogWithToggle.openConfirm(null,"String_Node_Str","String_Node_Str")) {
              return;
            }
            final List<ItemReferenceBean> unDeleteItems=RepositoryNodeDeleteManager.getInstance().getUnDeleteItems(repositoryObject,null,true);
            if (!unDeleteItems.isEmpty()) {
              ItemReferenceDialog dialog=new ItemReferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),unDeleteItems);
              dialog.open();
              return;
            }
            final Item newItem=ConvertJobsUtil.createOperation(originalName,originalJobType,originalFramework,repositoryObject);
            RepositoryWorkUnit repositoryWorkUnit=new RepositoryWorkUnit("String_Node_Str"){
              @Override public void run() throws PersistenceException {
                IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
                  @Override public void run(                  final IProgressMonitor monitor) throws CoreException {
                    try {
                      boolean isOpened=false;
                      if (repositoryObject instanceof IProcess2) {
                        isOpened=true;
                        boolean locked=proxyRepositoryFactory.getStatus(repositoryObject) == ERepositoryStatus.LOCK_BY_USER;
                        if (locked) {
                          proxyRepositoryFactory.unlock(repositoryObject);
                        }
                      }
                      boolean isNewItemCreated=true;
                      Property repositoryProperty=repositoryObject.getProperty();
                      if (repositoryProperty != null) {
                        isNewItemCreated=(repositoryProperty.getItem() != newItem);
                      }
                      if (isNewItemCreated) {
                        proxyRepositoryFactory.deleteObjectPhysical(repositoryObject);
                        proxyRepositoryFactory.saveProject(ProjectManager.getInstance().getCurrentProject());
                      }
 else                       if (repositoryObject.getProperty() != null) {
                        proxyRepositoryFactory.save(ProjectManager.getInstance().getCurrentProject(),repositoryObject.getProperty().getItem(),false);
                      }
                      if (newItem != null && newItem.getProperty() != null) {
                        String newId=newItem.getProperty().getId();
                        if (isNewItemCreated) {
                          newRepositoryObject=proxyRepositoryFactory.getLastVersion(ProjectManager.getInstance().getCurrentProject(),newId);
                        }
 else {
                          newRepositoryObject=repositoryObject;
                        }
                        if (!isOpened) {
                          repositoryObject=newRepositoryObject;
                          if (!jobTypeCCombo.isDisposed() && !jobFrameworkCCombo.isDisposed()) {
                            jobTypeValue=jobTypeCCombo.getText();
                            frameworkValue=jobFrameworkCCombo.getText();
                          }
                        }
                      }
                    }
 catch (                    PersistenceException e1) {
                      e1.printStackTrace();
                    }
catch (                    LoginException e) {
                      e.printStackTrace();
                    }
                  }
                }
;
                IWorkspace workspace=ResourcesPlugin.getWorkspace();
                try {
                  ISchedulingRule schedulingRule=workspace.getRoot();
                  workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
                }
 catch (                CoreException e1) {
                  MessageBoxExceptionHandler.process(e1.getCause());
                }
              }
            }
;
            repositoryWorkUnit.setAvoidSvnUpdate(true);
            repositoryWorkUnit.setAvoidUnloadResources(true);
            ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
            if (newItem != null && repositoryObject instanceof IProcess2) {
              if (newRepositoryObject != null && newRepositoryObject.getProperty() != null) {
                openEditorOperation(newRepositoryObject.getProperty().getItem());
              }
            }
          }
 else {
            if (newJobName != null) {
              property.setLabel(newJobName);
              property.setDisplayName(newJobName);
            }
            if (originalFramework != null) {
              if (property.getAdditionalProperties().containsKey(ConvertJobsUtil.FRAMEWORK)) {
                property.getAdditionalProperties().removeKey(ConvertJobsUtil.FRAMEWORK);
              }
              property.getAdditionalProperties().put(ConvertJobsUtil.FRAMEWORK,originalFramework);
            }
            RepositoryWorkUnit repositoryWorkUnit=new RepositoryWorkUnit("String_Node_Str"){
              @Override public void run() throws PersistenceException {
                IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
                  @Override public void run(                  final IProgressMonitor monitor) throws CoreException {
                    try {
                      if (repositoryObject.getProperty() != null) {
                        proxyRepositoryFactory.save(ProjectManager.getInstance().getCurrentProject(),repositoryObject.getProperty().getItem(),false);
                      }
                    }
 catch (                    PersistenceException e1) {
                      ExceptionHandler.process(e1);
                    }
                  }
                }
;
                IWorkspace workspace=ResourcesPlugin.getWorkspace();
                try {
                  ISchedulingRule schedulingRule=workspace.getRoot();
                  workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
                }
 catch (                CoreException e1) {
                  MessageBoxExceptionHandler.process(e1.getCause());
                }
              }
            }
;
            repositoryWorkUnit.setAvoidSvnUpdate(true);
            repositoryWorkUnit.setAvoidUnloadResources(true);
            ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
            if (repositoryObject instanceof IProcess2) {
              openEditorOperation(property.getItem());
            }
          }
          IViewPart jobSettingView=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
          if (jobSettingView != null && jobSettingView instanceof IJobSettingsView && !(repositoryObject instanceof IProcess2)) {
            Map<String,Object> propertiesMap=new HashMap<String,Object>();
            propertiesMap.put(IJobSettingsView.JOBTYPE_CHANGED,repositoryObject);
            ((IJobSettingsView)jobSettingView).onPropertiesChanged(propertiesMap);
          }
          if (!btnConfirm.isDisposed()) {
            btnConfirm.setEnabled(false);
          }
        }
      }
);
    }
  }
  IProxyRepositoryFactory repositoryFactory=ProxyRepositoryFactory.getInstance();
  final ERepositoryStatus repositoryStatus=ProxyRepositoryFactory.getInstance().getStatus(obj);
  if (repositoryFactory.isUserReadOnlyOnCurrentProject() || repositoryStatus == ERepositoryStatus.DELETED || repositoryStatus == ERepositoryStatus.LOCK_BY_OTHER || !ProjectManager.getInstance().isInCurrentMainProject(obj.getProperty())) {
    parent.setEnabled(false);
  }
 else {
    parent.setEnabled(true);
  }
}

Fixed version (ground truth):
/** 
 * yzhang MainComposite constructor comment.
 * @param parent
 * @param style
 */
public MainComposite(Composite parent,int style,TabbedPropertySheetWidgetFactory factory,IRepositoryViewObject obj){
  super(parent,style,factory,obj);
  IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
  boolean allowVerchange=brandingService.getBrandingConfiguration().isAllowChengeVersion();
  allowEnableControl=false;
  enableControl=false;
  String framework=null;
  if (obj instanceof RepositoryViewObject || obj instanceof IProcess2) {
    if (obj instanceof RepositoryViewObject) {
      framework=((RepositoryViewObject)obj).getFramework();
    }
 else {
      framework=(String)((IProcess2)obj).getAdditionalProperties().get(ConvertJobsUtil.FRAMEWORK);
    }
    if (ERepositoryObjectType.getAllTypesOfProcess().contains(repositoryObject.getRepositoryObjectType())) {
      allowEnableControl=true;
      enableControl=true;
      if (!PluginChecker.isMapReducePluginLoader() && !PluginChecker.isStormPluginLoader()) {
        allowEnableControl=false;
      }
      Item originalItem=repositoryObject.getProperty().getItem();
      if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
        ICamelDesignerCoreService camelService=(ICamelDesignerCoreService)GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
        if (camelService != null && camelService.isInstanceofCamel(originalItem)) {
          allowEnableControl=false;
          enableControl=false;
        }
      }
    }
  }
  FormLayout layout=new FormLayout();
  setLayout(layout);
  FormData thisFormData=new FormData();
  thisFormData.left=new FormAttachment(0,0);
  thisFormData.right=new FormAttachment(100,0);
  thisFormData.top=new FormAttachment(0,0);
  thisFormData.bottom=new FormAttachment(100,0);
  setLayoutData(thisFormData);
  Composite composite=widgetFactory.createFlatFormComposite(this);
  FormData compositeData=new FormData();
  compositeData.left=new FormAttachment(0,0);
  compositeData.right=new FormAttachment(100,0);
  compositeData.top=new FormAttachment(0,0);
  compositeData.bottom=new FormAttachment(100,0);
  composite.setLayoutData(thisFormData);
  nameText=widgetFactory.createText(composite,"String_Node_Str");
  FormData data=new FormData();
  data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  data.right=new FormAttachment(50,0);
  data.top=new FormAttachment(0,ITabbedPropertyConstants.VSPACE);
  nameText.setLayoutData(data);
  String nameContent=repositoryObject.getLabel();
  nameText.setText(nameContent != null ? nameContent : "String_Node_Str");
  nameText.setEnabled(allowEnableControl);
  nameTextDecorator=new ControlDecoration(nameText,SWT.TOP | SWT.RIGHT);
  FieldDecoration fieldDecoration=FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
  nameTextDecorator.setImage(fieldDecoration.getImage());
  nameTextDecorator.hide();
  CLabel nameLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(nameText,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(nameText,0,SWT.CENTER);
  nameLabel.setLayoutData(data);
  Text authorText=widgetFactory.createText(composite,"String_Node_Str");
  authorText.setEnabled(false);
  data=new FormData();
  data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  data.right=new FormAttachment(50,0);
  data.top=new FormAttachment(nameLabel,ITabbedPropertyConstants.VSPACE);
  authorText.setLayoutData(data);
  User user=repositoryObject.getAuthor();
  if (user != null) {
    String author=user.getLogin();
    authorText.setText(author != null ? author : "String_Node_Str");
  }
 else {
    authorText.setText(nameContent);
  }
  authorText.setEnabled(false);
  CLabel authorLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(authorText,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(authorText,0,SWT.CENTER);
  authorLabel.setLayoutData(data);
  if (allowVerchange) {
    btnDown=widgetFactory.createButton(composite,"String_Node_Str",SWT.PUSH);
    data=new FormData();
    data.right=new FormAttachment(100,0);
    data.top=new FormAttachment(authorText,0,SWT.CENTER);
    btnDown.setLayoutData(data);
    btnDown.setEnabled(allowEnableControl);
    btnUp=widgetFactory.createButton(composite,"String_Node_Str",SWT.PUSH);
    data=new FormData();
    data.right=new FormAttachment(btnDown,0);
    data.top=new FormAttachment(authorText,0,SWT.CENTER);
    btnUp.setLayoutData(data);
    btnUp.setEnabled(allowEnableControl);
    versionText=widgetFactory.createText(composite,"String_Node_Str");
    data=new FormData();
    data.left=new FormAttachment(authorText,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(btnUp,-2);
    data.top=new FormAttachment(authorText,0,SWT.CENTER);
    versionText.setLayoutData(data);
    String version=repositoryObject.getVersion();
    versionText.setText(version != null ? version : "String_Node_Str");
    versionText.setEditable(false);
    CLabel versionLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
    data=new FormData();
    data.left=new FormAttachment(authorText,ITabbedPropertyConstants.HSPACE * 3);
    data.right=new FormAttachment(versionText,-ITabbedPropertyConstants.HSPACE);
    data.top=new FormAttachment(versionText,0,SWT.CENTER);
    versionLabel.setLayoutData(data);
  }
  Text creationDate=widgetFactory.createText(composite,"String_Node_Str");
  data=new FormData();
  data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  data.right=new FormAttachment(50,0);
  data.top=new FormAttachment(authorLabel,ITabbedPropertyConstants.VSPACE);
  creationDate.setLayoutData(data);
  creationDate.setEnabled(false);
  Date cDate=repositoryObject.getCreationDate();
  creationDate.setText(cDate != null ? FORMATTER.format(cDate) : "String_Node_Str");
  creationDate.setEnabled(enableControl);
  CLabel creationLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(creationDate,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(creationDate,0,SWT.CENTER);
  creationLabel.setLayoutData(data);
  Text modificationDate=widgetFactory.createText(composite,"String_Node_Str");
  data=new FormData();
  data.left=new FormAttachment(creationDate,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  data.right=new FormAttachment(100,0);
  data.top=new FormAttachment(authorLabel,ITabbedPropertyConstants.VSPACE);
  modificationDate.setLayoutData(data);
  modificationDate.setEnabled(false);
  Date mDate=repositoryObject.getModificationDate();
  modificationDate.setText(mDate != null ? FORMATTER.format(mDate) : "String_Node_Str");
  modificationDate.setEnabled(enableControl);
  CLabel modificationLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(creationDate,ITabbedPropertyConstants.HSPACE - 10);
  data.right=new FormAttachment(modificationDate,ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(modificationDate,0,SWT.CENTER);
  modificationLabel.setLayoutData(data);
  final Map<String,String> statusMap=getStatusMap();
  if (allowEnableControl) {
    jobTypeCCombo=widgetFactory.createCCombo(composite,SWT.READ_ONLY | SWT.DROP_DOWN);
    data=new FormData();
    data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(50,0);
    data.top=new FormAttachment(creationDate,ITabbedPropertyConstants.VSPACE);
    jobTypeCCombo.setLayoutData(data);
    jobTypeCCombo.setItems(JobType.getJobTypeToDispaly());
    String jobType=ConvertJobsUtil.getJobTypeFromFramework(framework);
    jobTypeCCombo.setText(jobType);
    jobTypeValue=jobTypeCCombo.getText();
    jobTypeCCombo.setEnabled(allowEnableControl);
    String type=Messages.getString("String_Node_Str");
    if (obj.getProperty().getItem() instanceof JobletProcessItem) {
      type=Messages.getString("String_Node_Str");
    }
    CLabel jobTypeLabel=widgetFactory.createCLabel(composite,type);
    data=new FormData();
    data.left=new FormAttachment(0,0);
    data.right=new FormAttachment(jobTypeCCombo,-ITabbedPropertyConstants.HSPACE);
    data.top=new FormAttachment(jobTypeCCombo,0,SWT.CENTER);
    jobTypeLabel.setLayoutData(data);
    jobFrameworkCCombo=widgetFactory.createCCombo(composite,SWT.READ_ONLY | SWT.DROP_DOWN);
    data=new FormData();
    data.left=new FormAttachment(jobTypeCCombo,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(100,0);
    data.top=new FormAttachment(creationDate,ITabbedPropertyConstants.VSPACE);
    jobFrameworkCCombo.setLayoutData(data);
    jobFrameworkCCombo.setItems(ConvertJobsUtil.getFrameworkItemsByJobType(jobType,(obj.getProperty().getItem() instanceof JobletProcessItem)));
    jobFrameworkCCombo.setText(framework != null ? framework : "String_Node_Str");
    frameworkValue=jobFrameworkCCombo.getText();
    jobFrameworkCCombo.setEnabled(allowEnableControl);
    CLabel jobFrameworkLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
    data=new FormData();
    data.left=new FormAttachment(jobTypeCCombo,ITabbedPropertyConstants.HSPACE - 10);
    data.right=new FormAttachment(jobFrameworkCCombo,ITabbedPropertyConstants.HSPACE + 1);
    data.top=new FormAttachment(jobFrameworkCCombo,0,SWT.CENTER);
    jobFrameworkLabel.setLayoutData(data);
    purposeText=widgetFactory.createText(composite,"String_Node_Str");
    data=new FormData();
    data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(50,0);
    data.top=new FormAttachment(jobTypeLabel,ITabbedPropertyConstants.VSPACE);
    purposeText.setLayoutData(data);
    String content=repositoryObject.getPurpose();
    purposeText.setText(content != null ? content : "String_Node_Str");
    purposeText.setEnabled(allowEnableControl);
    CLabel purposeLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
    data=new FormData();
    data.left=new FormAttachment(0,0);
    data.right=new FormAttachment(purposeText,-ITabbedPropertyConstants.HSPACE);
    data.top=new FormAttachment(purposeText,0,SWT.CENTER);
    purposeLabel.setLayoutData(data);
    statusText=widgetFactory.createCCombo(composite,SWT.READ_ONLY | SWT.BORDER);
    data=new FormData();
    data.left=new FormAttachment(purposeText,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(100,0);
    data.top=new FormAttachment(jobTypeLabel,ITabbedPropertyConstants.VSPACE);
    statusText.setLayoutData(data);
    String status=repositoryObject.getStatusCode();
    statusText.setText(status != null ? status : "String_Node_Str");
    statusText.setItems(Status.getStatusToDispaly());
    statusLabelText=statusMap.get(status);
    setStatusComboText(statusLabelText);
    statusText.setEnabled(allowEnableControl);
  }
 else {
    purposeText=widgetFactory.createText(composite,"String_Node_Str");
    data=new FormData();
    data.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(50,0);
    data.top=new FormAttachment(creationDate,ITabbedPropertyConstants.VSPACE);
    purposeText.setLayoutData(data);
    String content=repositoryObject.getPurpose();
    purposeText.setText(content != null ? content : "String_Node_Str");
    purposeText.setEnabled(enableControl);
    CLabel purposeLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
    data=new FormData();
    data.left=new FormAttachment(0,0);
    data.right=new FormAttachment(purposeText,-ITabbedPropertyConstants.HSPACE);
    data.top=new FormAttachment(purposeText,0,SWT.CENTER);
    purposeLabel.setLayoutData(data);
    statusText=widgetFactory.createCCombo(composite,SWT.READ_ONLY | SWT.BORDER);
    data=new FormData();
    data.left=new FormAttachment(purposeText,AbstractPropertySection.STANDARD_LABEL_WIDTH);
    data.right=new FormAttachment(100,0);
    data.top=new FormAttachment(creationDate,ITabbedPropertyConstants.VSPACE);
    statusText.setLayoutData(data);
    String status=repositoryObject.getStatusCode();
    statusText.setText(status != null ? status : "String_Node_Str");
    statusLabelText=statusMap.get(status);
    setStatusComboText(statusLabelText);
    statusText.setEnabled(enableControl);
  }
  CLabel statusLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(purposeText,ITabbedPropertyConstants.HSPACE * 3);
  data.right=new FormAttachment(statusText,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(statusText,0,SWT.CENTER);
  statusLabel.setLayoutData(data);
  statusText.setItems(Status.getStatusToDispaly());
  String status=repositoryObject.getStatusCode();
  statusLabelText=statusMap.get(status);
  setStatusComboText(statusLabelText);
  descriptionText=widgetFactory.createText(composite,"String_Node_Str",SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
  FormData descriptionData=new FormData();
  descriptionData.left=new FormAttachment(0,AbstractPropertySection.STANDARD_LABEL_WIDTH);
  descriptionData.right=new FormAttachment(100,0);
  descriptionData.top=new FormAttachment(statusText,ITabbedPropertyConstants.VSPACE);
  descriptionData.height=NB_LINES * descriptionText.getLineHeight();
  descriptionText.setLayoutData(descriptionData);
  if (!allowEnableControl) {
    descriptionData.bottom=new FormAttachment(100);
  }
  String description=repositoryObject.getDescription();
  descriptionText.setText(description != null ? description : "String_Node_Str");
  descriptionText.setEnabled(true);
  descriptionText.setEditable(allowEnableControl);
  CLabel descriptionLabel=widgetFactory.createCLabel(composite,Messages.getString("String_Node_Str"));
  data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(descriptionText,-ITabbedPropertyConstants.HSPACE);
  data.top=new FormAttachment(descriptionText,0,SWT.TOP);
  descriptionLabel.setLayoutData(data);
  if (allowEnableControl) {
    btnConfirm=widgetFactory.createButton(composite,"String_Node_Str",SWT.PUSH);
    descriptionData.bottom=new FormAttachment(btnConfirm,0,SWT.TOP);
    data=new FormData();
    data.right=new FormAttachment(descriptionText,ITabbedPropertyConstants.HSPACE - 1,SWT.RIGHT);
    data.bottom=new FormAttachment(100);
    btnConfirm.setLayoutData(data);
    btnConfirm.setEnabled(false);
    nameText.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    jobTypeCCombo.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        ConvertJobsUtil.updateJobFrameworkPart(jobTypeCCombo.getText(),jobFrameworkCCombo,(obj.getProperty().getItem() instanceof JobletProcessItem));
        evaluateTextField();
      }
    }
);
    jobFrameworkCCombo.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    purposeText.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    statusText.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    descriptionText.addModifyListener(new ModifyListener(){
      @Override public void modifyText(      final ModifyEvent e){
        evaluateTextField();
      }
    }
);
    if (allowVerchange) {
      btnUp.addSelectionListener(new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          String version=repositoryObject.getVersion();
          if (lastVersionFound != null && VersionUtils.compareTo(lastVersionFound,version) > 0) {
            version=lastVersionFound;
          }
          version=VersionUtils.upMajor(version);
          versionText.setText(version);
          lastVersionFound=version;
          evaluateTextField();
        }
      }
);
      btnDown.addSelectionListener(new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          String version=repositoryObject.getVersion();
          if (lastVersionFound != null && VersionUtils.compareTo(lastVersionFound,version) > 0) {
            version=lastVersionFound;
          }
          version=VersionUtils.upMinor(version);
          versionText.setText(version);
          lastVersionFound=version;
          evaluateTextField();
        }
      }
);
      btnConfirm.addSelectionListener(new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          final IProxyRepositoryFactory proxyRepositoryFactory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
          Property property=repositoryObject.getProperty();
          if (nameText == null || nameText.isDisposed() || versionText == null || versionText.isDisposed() || purposeText == null || purposeText.isDisposed() || jobTypeCCombo == null || jobTypeCCombo.isDisposed() || jobFrameworkCCombo == null || jobFrameworkCCombo.isDisposed() || statusText == null || statusText.isDisposed() || descriptionText == null || descriptionText.isDisposed() || btnConfirm == null || btnConfirm.isDisposed() || property == null) {
            return;
          }
          String originalName=nameText.getText();
          String originalJobType=jobTypeCCombo.getText();
          String originalFramework=jobFrameworkCCombo.getText();
          String originalversion=versionText.getText();
          String originalPurpose=purposeText.getText();
          String originalStatus=statusText.getText();
          String originalDescription=descriptionText.getText();
          saveJobEditor(repositoryObject);
          if (repositoryObject instanceof IProcess2) {
            IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
              @Override public void run(              final IProgressMonitor monitor) throws CoreException {
                DeleteActionCache.getInstance().closeOpenedEditor(repositoryObject);
              }
            }
;
            IWorkspace workspace=ResourcesPlugin.getWorkspace();
            try {
              ISchedulingRule schedulingRule=workspace.getRoot();
              workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
            }
 catch (            CoreException e1) {
              MessageBoxExceptionHandler.process(e1.getCause());
            }
          }
          String newJobName=null;
          if (!originalName.equals(StringUtils.trimToEmpty(repositoryObject.getLabel()))) {
            newJobName=originalName;
          }
          if (!originalversion.equals(StringUtils.trimToEmpty(repositoryObject.getVersion()))) {
            property.setVersion(originalversion);
          }
          if (!originalPurpose.equals(StringUtils.trimToEmpty(repositoryObject.getPurpose()))) {
            property.setPurpose(originalPurpose);
          }
          if (!originalStatus.equals(StringUtils.trimToEmpty(repositoryObject.getStatusCode()))) {
            property.setStatusCode(getStatusCode(statusMap,originalStatus));
          }
          if (!originalDescription.equals(StringUtils.trimToEmpty(repositoryObject.getDescription()))) {
            property.setDescription(originalDescription);
          }
          Item originalItem=repositoryObject.getProperty().getItem();
          if (ConvertJobsUtil.isNeedConvert(originalItem,originalJobType,originalFramework,true)) {
            boolean hasTestCase=ConvertJobsUtil.hasTestCase(repositoryObject.getProperty());
            final List<ItemReferenceBean> unDeleteItems=RepositoryNodeDeleteManager.getInstance().getUnDeleteItems(repositoryObject,null,true);
            if (!unDeleteItems.isEmpty()) {
              ItemReferenceDialog dialog=new ItemReferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),unDeleteItems);
              dialog.open();
              return;
            }
            final Item newItem=ConvertJobsUtil.createOperation(originalName,originalJobType,originalFramework,repositoryObject);
            if (newItem != null) {
              ConvertJobsUtil.convertTestcases(newItem,repositoryObject,originalJobType);
            }
            RepositoryWorkUnit repositoryWorkUnit=new RepositoryWorkUnit("String_Node_Str"){
              @Override public void run() throws PersistenceException {
                IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
                  @Override public void run(                  final IProgressMonitor monitor) throws CoreException {
                    try {
                      boolean isOpened=false;
                      if (repositoryObject instanceof IProcess2) {
                        isOpened=true;
                        boolean locked=proxyRepositoryFactory.getStatus(repositoryObject) == ERepositoryStatus.LOCK_BY_USER;
                        if (locked) {
                          proxyRepositoryFactory.unlock(repositoryObject);
                        }
                      }
                      boolean isNewItemCreated=true;
                      Property repositoryProperty=repositoryObject.getProperty();
                      if (repositoryProperty != null) {
                        isNewItemCreated=(repositoryProperty.getItem() != newItem);
                      }
                      if (isNewItemCreated) {
                        proxyRepositoryFactory.deleteObjectPhysical(repositoryObject);
                        proxyRepositoryFactory.saveProject(ProjectManager.getInstance().getCurrentProject());
                      }
 else                       if (repositoryObject.getProperty() != null) {
                        proxyRepositoryFactory.save(ProjectManager.getInstance().getCurrentProject(),repositoryObject.getProperty().getItem(),false);
                      }
                      if (newItem != null && newItem.getProperty() != null) {
                        String newId=newItem.getProperty().getId();
                        if (isNewItemCreated) {
                          newRepositoryObject=proxyRepositoryFactory.getLastVersion(ProjectManager.getInstance().getCurrentProject(),newId);
                        }
 else {
                          newRepositoryObject=repositoryObject;
                        }
                        if (!isOpened) {
                          repositoryObject=newRepositoryObject;
                          if (!jobTypeCCombo.isDisposed() && !jobFrameworkCCombo.isDisposed()) {
                            jobTypeValue=jobTypeCCombo.getText();
                            frameworkValue=jobFrameworkCCombo.getText();
                          }
                        }
                      }
                    }
 catch (                    PersistenceException e1) {
                      e1.printStackTrace();
                    }
catch (                    LoginException e) {
                      e.printStackTrace();
                    }
                  }
                }
;
                IWorkspace workspace=ResourcesPlugin.getWorkspace();
                try {
                  ISchedulingRule schedulingRule=workspace.getRoot();
                  workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
                }
 catch (                CoreException e1) {
                  MessageBoxExceptionHandler.process(e1.getCause());
                }
              }
            }
;
            repositoryWorkUnit.setAvoidSvnUpdate(true);
            repositoryWorkUnit.setAvoidUnloadResources(true);
            ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
            if (newItem != null && repositoryObject instanceof IProcess2) {
              if (newRepositoryObject != null && newRepositoryObject.getProperty() != null) {
                openEditorOperation(newRepositoryObject.getProperty().getItem());
              }
            }
          }
 else {
            if (newJobName != null) {
              property.setLabel(newJobName);
              property.setDisplayName(newJobName);
            }
            if (originalFramework != null) {
              if (property.getAdditionalProperties().containsKey(ConvertJobsUtil.FRAMEWORK)) {
                property.getAdditionalProperties().removeKey(ConvertJobsUtil.FRAMEWORK);
              }
              property.getAdditionalProperties().put(ConvertJobsUtil.FRAMEWORK,originalFramework);
            }
            RepositoryWorkUnit repositoryWorkUnit=new RepositoryWorkUnit("String_Node_Str"){
              @Override public void run() throws PersistenceException {
                IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
                  @Override public void run(                  final IProgressMonitor monitor) throws CoreException {
                    try {
                      if (repositoryObject.getProperty() != null) {
                        proxyRepositoryFactory.save(ProjectManager.getInstance().getCurrentProject(),repositoryObject.getProperty().getItem(),false);
                      }
                    }
 catch (                    PersistenceException e1) {
                      ExceptionHandler.process(e1);
                    }
                  }
                }
;
                IWorkspace workspace=ResourcesPlugin.getWorkspace();
                try {
                  ISchedulingRule schedulingRule=workspace.getRoot();
                  workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
                }
 catch (                CoreException e1) {
                  MessageBoxExceptionHandler.process(e1.getCause());
                }
              }
            }
;
            repositoryWorkUnit.setAvoidSvnUpdate(true);
            repositoryWorkUnit.setAvoidUnloadResources(true);
            ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
            if (repositoryObject instanceof IProcess2) {
              openEditorOperation(property.getItem());
            }
          }
          IViewPart jobSettingView=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
          if (jobSettingView != null && jobSettingView instanceof IJobSettingsView && !(repositoryObject instanceof IProcess2)) {
            Map<String,Object> propertiesMap=new HashMap<String,Object>();
            propertiesMap.put(IJobSettingsView.JOBTYPE_CHANGED,repositoryObject);
            ((IJobSettingsView)jobSettingView).onPropertiesChanged(propertiesMap);
          }
          if (!btnConfirm.isDisposed()) {
            btnConfirm.setEnabled(false);
          }
        }
      }
);
    }
  }
  IProxyRepositoryFactory repositoryFactory=ProxyRepositoryFactory.getInstance();
  final ERepositoryStatus repositoryStatus=ProxyRepositoryFactory.getInstance().getStatus(obj);
  if (repositoryFactory.isUserReadOnlyOnCurrentProject() || repositoryStatus == ERepositoryStatus.DELETED || repositoryStatus == ERepositoryStatus.LOCK_BY_OTHER || !ProjectManager.getInstance().isInCurrentMainProject(obj.getProperty())) {
    parent.setEnabled(false);
  }
 else {
    parent.setEnabled(true);
  }
}