Program: 148617
Project: 148617
Buggy source:
public void run(){
  try {
    super.run();
    ISelection selection=view.getViewer().getSelection();
    TreeObject xobject=(TreeObject)((IStructuredSelection)selection).getFirstElement();
    xobject=LocalTreeObjectRepository.getInstance().registerNewTreeObject(xobject);
    TreeParent xfolder=(xobject.isXObject()) ? xobject.getParent() : (TreeParent)xobject;
    Object key=null;
switch (xfolder.getType()) {
case TreeObject.SOURCE:
      title="String_Node_Str";
    break;
case TreeObject.DESTINATION:
  title="String_Node_Str";
break;
case TreeObject.DATA_MODEL:
title="String_Node_Str";
break;
case TreeObject.RESOURCES:
title="String_Node_Str";
break;
case TreeObject.CUSTOM_TYPE:
title="String_Node_Str";
break;
case TreeObject.INBOUND_ADAPTOR:
title="String_Node_Str";
break;
case TreeObject.INBOUND_PLUGIN:
title="String_Node_Str";
break;
case TreeObject.OUTBOUND_ADAPTOR:
title="String_Node_Str";
break;
case TreeObject.OUTBOUND_PLUGIN:
title="String_Node_Str";
break;
case TreeObject.DATA_CLUSTER:
title="String_Node_Str";
break;
case TreeObject.STORED_PROCEDURE:
title="String_Node_Str";
break;
case TreeObject.ROUTING_RULE:
title="String_Node_Str";
break;
case TreeObject.MENU:
title="String_Node_Str";
break;
case TreeObject.UNIVERSE:
title="String_Node_Str";
break;
case TreeObject.SYNCHRONIZATIONPLAN:
title="String_Node_Str";
break;
case TreeObject.TRANSFORMER:
title="String_Node_Str";
break;
case TreeObject.VIEW:
title="String_Node_Str";
break;
default :
return;
}
switch (xfolder.getType()) {
case TreeObject.TRANSFORMER:
ViewInputDialog vid=new ViewInputDialog(view.getSite(),(TreeParent)view.getRoot().getChildren()[0].findServerFolder(TreeObject.TRANSFORMER),view.getSite().getShell(),title,"String_Node_Str","String_Node_Str",new IInputValidator(){
public String isValid(String newText){
if ((newText == null) || "String_Node_Str".equals(newText)) return "String_Node_Str";
if (!Pattern.matches("String_Node_Str",newText)) {
return "String_Node_Str";
}
return null;
}
}
,true);
vid.setBtnShow(false);
vid.create();
vid.setBlockOnOpen(true);
if (vid.open() == Window.CANCEL) return;
key=vid.getValue();
break;
case TreeObject.VIEW:
ViewInputDialog tid=new ViewInputDialog(view.getSite(),(TreeParent)view.getRoot().getChildren()[0].findServerFolder(TreeObject.TRANSFORMER),view.getSite().getShell(),title,"String_Node_Str","String_Node_Str",new IInputValidator(){
public String isValid(String newText){
if ((newText == null) || "String_Node_Str".equals(newText)) return "String_Node_Str";
if (!Pattern.matches("String_Node_Str",newText)) {
return "String_Node_Str";
}
return null;
}
}
,false);
tid.create();
tid.getShell().setSize(new Point(600,180));
tid.setBlockOnOpen(true);
if (tid.open() == Window.CANCEL) return;
key=tid.getValue();
break;
case TreeObject.SOURCE:
case TreeObject.CUSTOM_TYPE:
case TreeObject.DESTINATION:
case TreeObject.DATA_MODEL:
case TreeObject.INBOUND_ADAPTOR:
case TreeObject.INBOUND_PLUGIN:
case TreeObject.OUTBOUND_ADAPTOR:
case TreeObject.OUTBOUND_PLUGIN:
case TreeObject.DATA_CLUSTER:
case TreeObject.STORED_PROCEDURE:
case TreeObject.ROUTING_RULE:
case TreeObject.MENU:
case TreeObject.UNIVERSE:
case TreeObject.SYNCHRONIZATIONPLAN:
InputDialog id1=new InputDialog(view.getSite().getShell(),title,"String_Node_Str",null,new IInputValidator(){
public String isValid(String newText){
if ((newText == null) || "String_Node_Str".equals(newText)) return "String_Node_Str";
if (!Pattern.matches("String_Node_Str",newText)) {
return "String_Node_Str";
}
return null;
}
}
);
id1.setBlockOnOpen(true);
if (id1.open() == Window.CANCEL) return;
key=id1.getValue();
break;
default :
return;
}
XtentisPort port=Util.getPort(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
TreeObject newInstance=null;
switch (xobject.getType()) {
case TreeObject.DATA_MODEL:
{
if (port.existsDataModel(new WSExistsDataModel(new WSDataModelPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSDataModel wsDataModel=new WSDataModel((String)key,"String_Node_Str","String_Node_Str" + "String_Node_Str");
port.putDataModel(new WSPutDataModel(wsDataModel));
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.DATA_MODEL,new WSDataModelPK((String)key),wsDataModel);
break;
}
case TreeObject.VIEW:
{
if (port.existsView(new WSExistsView(new WSViewPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSDataModelPK[] dataModelPKs=Util.getAllDataModelPKs(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
String firstDataModel=null;
for (int i=0; i < dataModelPKs.length; i++) {
if (dataModelPKs[i].getPk().indexOf("String_Node_Str") == -1) {
firstDataModel=dataModelPKs[i].getPk();
break;
}
}
if (firstDataModel == null) {
MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
return;
}
WSDataClusterPK[] dataClusterPKs=Util.getAllDataClusterPKs(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
String firstItemCluster=null;
for (int i=0; i < dataClusterPKs.length; i++) {
if (!dataClusterPKs[i].getPk().equals("String_Node_Str")) {
firstItemCluster=dataClusterPKs[i].getPk();
break;
}
}
if (firstItemCluster == null) {
MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
return;
}
WSView wsview=new WSView((String)key,"String_Node_Str",new String[]{},new WSWhereCondition[0],new String[]{});
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.VIEW,new WSViewPK((String)key),wsview);
break;
}
case TreeObject.DATA_CLUSTER:
{
if (port.existsDataCluster(new WSExistsDataCluster(new WSDataClusterPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSDataCluster dc=new WSDataCluster((String)key,"String_Node_Str","String_Node_Str");
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.DATA_CLUSTER,new WSDataClusterPK((String)key),dc);
break;
}
case TreeObject.STORED_PROCEDURE:
{
if (port.existsStoredProcedure(new WSExistsStoredProcedure(new WSStoredProcedurePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSStoredProcedure storedProcedure=new WSStoredProcedure((String)key,"String_Node_Str","String_Node_Str");
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.STORED_PROCEDURE,new WSStoredProcedurePK((String)key),storedProcedure);
break;
}
case TreeObject.ROLE:
{
if (port.existsRole(new WSExistsRole(new WSRolePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSRole role=new WSRole((String)key,"String_Node_Str",null);
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.ROLE,new WSRolePK((String)key),role);
break;
}
case TreeObject.ROUTING_RULE:
{
if (port.existsRoutingRule(new WSExistsRoutingRule(new WSRoutingRulePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSRoutingRule routingRule=new WSRoutingRule((String)key,"String_Node_Str",false,"String_Node_Str","String_Node_Str","String_Node_Str",new WSRoutingRuleExpression[0],null,false);
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.ROUTING_RULE,new WSRoutingRulePK((String)key),routingRule);
break;
}
case TreeObject.TRANSFORMER:
{
if (port.existsTransformerV2(new WSExistsTransformerV2(new WSTransformerV2PK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSTransformerV2 transformer=new WSTransformerV2((String)key,"String_Node_Str",null);
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.TRANSFORMER,new WSTransformerV2PK((String)key),transformer);
break;
}
case TreeObject.MENU:
{
if (port.existsMenu(new WSExistsMenu(new WSMenuPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSMenu menu=new WSMenu((String)key,"String_Node_Str",new WSMenuEntry[]{new WSMenuEntry((String)key,new WSMenuMenuEntriesDescriptions[]{new WSMenuMenuEntriesDescriptions("String_Node_Str",(String)key)},null,null,null,null)});
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.MENU,new WSMenuPK((String)key),menu);
break;
}
case TreeObject.UNIVERSE:
{
if (port.existsUniverse(new WSExistsUniverse(new WSUniversePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
List<WSUniverseXtentisObjectsRevisionIDs> objectsId=new ArrayList<WSUniverseXtentisObjectsRevisionIDs>();
for (String object : port.getObjectsForUniverses(new WSGetObjectsForUniverses(new String[]{"String_Node_Str"})).getStrings()) {
objectsId.add(new WSUniverseXtentisObjectsRevisionIDs(object,"String_Node_Str"));
}
WSUniverse universe=new WSUniverse((String)key,"String_Node_Str",objectsId.toArray(new WSUniverseXtentisObjectsRevisionIDs[objectsId.size()]),"String_Node_Str",new WSUniverseItemsRevisionIDs[]{});
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.UNIVERSE,new WSUniversePK((String)key),universe);
break;
}
case TreeObject.SYNCHRONIZATIONPLAN:
{
if (port.existsSynchronizationPlan(new WSExistsSynchronizationPlan(new WSSynchronizationPlanPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
List<WSSynchronizationPlanXtentisObjectsSynchronizations> objectsId=new ArrayList<WSSynchronizationPlanXtentisObjectsSynchronizations>();
for (String object : port.getObjectsForSynchronizationPlans(new WSGetObjectsForSynchronizationPlans(new String[]{"String_Node_Str"})).getStrings()) {
objectsId.add(new WSSynchronizationPlanXtentisObjectsSynchronizations(object,new WSSynchronizationPlanXtentisObjectsSynchronizationsSynchronizations[0]));
}
Calendar calendar=Calendar.getInstance();
calendar.setTimeInMillis(0);
WSSynchronizationPlan synchronizationPlan=new WSSynchronizationPlan((String)key,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",objectsId.toArray(new WSSynchronizationPlanXtentisObjectsSynchronizations[objectsId.size()]),new WSSynchronizationPlanItemsSynchronizations[]{});
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.SYNCHRONIZATIONPLAN,new WSSynchronizationPlanPK((String)key),synchronizationPlan);
break;
}
case TreeObject.CUSTOM_TYPE:
{
if (port.existsUniverse(new WSExistsUniverse(new WSUniversePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.CUSTOM_TYPE,null,null);
break;
}
default :
return;
}
{
LocalTreeObjectRepository.getInstance().mergeNewTreeObject(newInstance);
XObjectEditor editpart=(XObjectEditor)view.getSite().getWorkbenchWindow().getActivePage().openEditor(new XObjectEditorInput(newInstance,newInstance.getDisplayName()),"String_Node_Str");
if (editpart.getSelectedPage() instanceof AMainPageV2) {
((AMainPageV2)editpart.getSelectedPage()).markDirty();
}
if (editpart.getSelectedPage() instanceof AMainPage) ((AMainPage)editpart.getSelectedPage()).markDirty();
}
}
 catch (Exception e) {
e.printStackTrace();
MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str" + IConstants.TALEND + "String_Node_Str"+ e.getLocalizedMessage());
}
}

Fixed version (ground truth):
public void run(){
  try {
    super.run();
    ISelection selection=view.getViewer().getSelection();
    TreeObject xobject=(TreeObject)((IStructuredSelection)selection).getFirstElement();
    xobject=LocalTreeObjectRepository.getInstance().registerNewTreeObject(xobject);
    TreeParent xfolder=(xobject.isXObject()) ? xobject.getParent() : (TreeParent)xobject;
    Object key=null;
switch (xfolder.getType()) {
case TreeObject.SOURCE:
      title="String_Node_Str";
    break;
case TreeObject.DESTINATION:
  title="String_Node_Str";
break;
case TreeObject.DATA_MODEL:
title="String_Node_Str";
break;
case TreeObject.RESOURCES:
title="String_Node_Str";
break;
case TreeObject.CUSTOM_TYPE:
title="String_Node_Str";
break;
case TreeObject.INBOUND_ADAPTOR:
title="String_Node_Str";
break;
case TreeObject.INBOUND_PLUGIN:
title="String_Node_Str";
break;
case TreeObject.OUTBOUND_ADAPTOR:
title="String_Node_Str";
break;
case TreeObject.OUTBOUND_PLUGIN:
title="String_Node_Str";
break;
case TreeObject.DATA_CLUSTER:
title="String_Node_Str";
break;
case TreeObject.STORED_PROCEDURE:
title="String_Node_Str";
break;
case TreeObject.ROUTING_RULE:
title="String_Node_Str";
break;
case TreeObject.MENU:
title="String_Node_Str";
break;
case TreeObject.UNIVERSE:
title="String_Node_Str";
break;
case TreeObject.SYNCHRONIZATIONPLAN:
title="String_Node_Str";
break;
case TreeObject.TRANSFORMER:
title="String_Node_Str";
break;
case TreeObject.VIEW:
title="String_Node_Str";
break;
default :
return;
}
switch (xfolder.getType()) {
case TreeObject.TRANSFORMER:
ViewInputDialog vid=new ViewInputDialog(view.getSite(),(TreeParent)view.getRoot().getChildren()[0].findServerFolder(TreeObject.TRANSFORMER),view.getSite().getShell(),title,"String_Node_Str","String_Node_Str",new IInputValidator(){
public String isValid(String newText){
if ((newText == null) || "String_Node_Str".equals(newText)) return "String_Node_Str";
if (!Pattern.matches("String_Node_Str",newText)) {
return "String_Node_Str";
}
return null;
}
}
,true);
vid.setBtnShow(false);
vid.create();
vid.setBlockOnOpen(true);
if (vid.open() == Window.CANCEL) return;
key=vid.getValue();
break;
case TreeObject.VIEW:
ViewInputDialog tid=new ViewInputDialog(view.getSite(),(TreeParent)view.getRoot().getChildren()[0].findServerFolder(TreeObject.TRANSFORMER),view.getSite().getShell(),title,"String_Node_Str","String_Node_Str",new IInputValidator(){
public String isValid(String newText){
if ((newText == null) || "String_Node_Str".equals(newText)) return "String_Node_Str";
if (!Pattern.matches("String_Node_Str",newText)) {
return "String_Node_Str";
}
return null;
}
}
,false);
tid.create();
tid.getShell().setSize(new Point(600,180));
tid.setBlockOnOpen(true);
if (tid.open() == Window.CANCEL) return;
key=tid.getValue();
break;
case TreeObject.SOURCE:
case TreeObject.CUSTOM_TYPE:
case TreeObject.DESTINATION:
case TreeObject.DATA_MODEL:
case TreeObject.INBOUND_ADAPTOR:
case TreeObject.INBOUND_PLUGIN:
case TreeObject.OUTBOUND_ADAPTOR:
case TreeObject.OUTBOUND_PLUGIN:
case TreeObject.DATA_CLUSTER:
case TreeObject.STORED_PROCEDURE:
case TreeObject.ROUTING_RULE:
case TreeObject.MENU:
case TreeObject.UNIVERSE:
case TreeObject.SYNCHRONIZATIONPLAN:
InputDialog id1=new InputDialog(view.getSite().getShell(),title,"String_Node_Str",null,new IInputValidator(){
public String isValid(String newText){
if ((newText == null) || "String_Node_Str".equals(newText)) return "String_Node_Str";
if (!Pattern.matches("String_Node_Str",newText)) {
return "String_Node_Str";
}
return null;
}
}
);
id1.setBlockOnOpen(true);
if (id1.open() == Window.CANCEL) return;
key=id1.getValue();
break;
default :
return;
}
XtentisPort port=Util.getPort(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
TreeObject newInstance=null;
switch (xobject.getType()) {
case TreeObject.DATA_MODEL:
{
if (port.existsDataModel(new WSExistsDataModel(new WSDataModelPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSDataModel wsDataModel=new WSDataModel((String)key,"String_Node_Str","String_Node_Str" + "String_Node_Str");
port.putDataModel(new WSPutDataModel(wsDataModel));
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.DATA_MODEL,new WSDataModelPK((String)key),wsDataModel);
break;
}
case TreeObject.VIEW:
{
if (port.existsView(new WSExistsView(new WSViewPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSDataModelPK[] dataModelPKs=Util.getAllDataModelPKs(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
String firstDataModel=null;
for (int i=0; i < dataModelPKs.length; i++) {
if (dataModelPKs[i].getPk().indexOf("String_Node_Str") == -1) {
firstDataModel=dataModelPKs[i].getPk();
break;
}
}
if (firstDataModel == null) {
MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
return;
}
WSDataClusterPK[] dataClusterPKs=Util.getAllDataClusterPKs(new URL(xobject.getEndpointAddress()),xobject.getUniverse(),xobject.getUsername(),xobject.getPassword());
String firstItemCluster=null;
for (int i=0; i < dataClusterPKs.length; i++) {
if (!dataClusterPKs[i].getPk().equals("String_Node_Str")) {
firstItemCluster=dataClusterPKs[i].getPk();
break;
}
}
if (firstItemCluster == null) {
MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str");
return;
}
WSView wsview=new WSView((String)key,"String_Node_Str",new String[]{},new WSWhereCondition[0],new String[]{},null,new WSBoolean(false));
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.VIEW,new WSViewPK((String)key),wsview);
break;
}
case TreeObject.DATA_CLUSTER:
{
if (port.existsDataCluster(new WSExistsDataCluster(new WSDataClusterPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSDataCluster dc=new WSDataCluster((String)key,"String_Node_Str","String_Node_Str");
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.DATA_CLUSTER,new WSDataClusterPK((String)key),dc);
break;
}
case TreeObject.STORED_PROCEDURE:
{
if (port.existsStoredProcedure(new WSExistsStoredProcedure(new WSStoredProcedurePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSStoredProcedure storedProcedure=new WSStoredProcedure((String)key,"String_Node_Str","String_Node_Str");
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.STORED_PROCEDURE,new WSStoredProcedurePK((String)key),storedProcedure);
break;
}
case TreeObject.ROLE:
{
if (port.existsRole(new WSExistsRole(new WSRolePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSRole role=new WSRole((String)key,"String_Node_Str",null);
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.ROLE,new WSRolePK((String)key),role);
break;
}
case TreeObject.ROUTING_RULE:
{
if (port.existsRoutingRule(new WSExistsRoutingRule(new WSRoutingRulePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSRoutingRule routingRule=new WSRoutingRule((String)key,"String_Node_Str",false,"String_Node_Str","String_Node_Str","String_Node_Str",new WSRoutingRuleExpression[0],null,false);
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.ROUTING_RULE,new WSRoutingRulePK((String)key),routingRule);
break;
}
case TreeObject.TRANSFORMER:
{
if (port.existsTransformerV2(new WSExistsTransformerV2(new WSTransformerV2PK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSTransformerV2 transformer=new WSTransformerV2((String)key,"String_Node_Str",null);
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.TRANSFORMER,new WSTransformerV2PK((String)key),transformer);
break;
}
case TreeObject.MENU:
{
if (port.existsMenu(new WSExistsMenu(new WSMenuPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
WSMenu menu=new WSMenu((String)key,"String_Node_Str",new WSMenuEntry[]{new WSMenuEntry((String)key,new WSMenuMenuEntriesDescriptions[]{new WSMenuMenuEntriesDescriptions("String_Node_Str",(String)key)},null,null,null,null)});
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.MENU,new WSMenuPK((String)key),menu);
break;
}
case TreeObject.UNIVERSE:
{
if (port.existsUniverse(new WSExistsUniverse(new WSUniversePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
List<WSUniverseXtentisObjectsRevisionIDs> objectsId=new ArrayList<WSUniverseXtentisObjectsRevisionIDs>();
for (String object : port.getObjectsForUniverses(new WSGetObjectsForUniverses(new String[]{"String_Node_Str"})).getStrings()) {
objectsId.add(new WSUniverseXtentisObjectsRevisionIDs(object,"String_Node_Str"));
}
WSUniverse universe=new WSUniverse((String)key,"String_Node_Str",objectsId.toArray(new WSUniverseXtentisObjectsRevisionIDs[objectsId.size()]),"String_Node_Str",new WSUniverseItemsRevisionIDs[]{});
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.UNIVERSE,new WSUniversePK((String)key),universe);
break;
}
case TreeObject.SYNCHRONIZATIONPLAN:
{
if (port.existsSynchronizationPlan(new WSExistsSynchronizationPlan(new WSSynchronizationPlanPK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
List<WSSynchronizationPlanXtentisObjectsSynchronizations> objectsId=new ArrayList<WSSynchronizationPlanXtentisObjectsSynchronizations>();
for (String object : port.getObjectsForSynchronizationPlans(new WSGetObjectsForSynchronizationPlans(new String[]{"String_Node_Str"})).getStrings()) {
objectsId.add(new WSSynchronizationPlanXtentisObjectsSynchronizations(object,new WSSynchronizationPlanXtentisObjectsSynchronizationsSynchronizations[0]));
}
Calendar calendar=Calendar.getInstance();
calendar.setTimeInMillis(0);
WSSynchronizationPlan synchronizationPlan=new WSSynchronizationPlan((String)key,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",objectsId.toArray(new WSSynchronizationPlanXtentisObjectsSynchronizations[objectsId.size()]),new WSSynchronizationPlanItemsSynchronizations[]{});
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.SYNCHRONIZATIONPLAN,new WSSynchronizationPlanPK((String)key),synchronizationPlan);
break;
}
case TreeObject.CUSTOM_TYPE:
{
if (port.existsUniverse(new WSExistsUniverse(new WSUniversePK((String)key))).is_true()) {
MessageDialog.openError(this.view.getSite().getShell(),"String_Node_Str","String_Node_Str" + (String)key + "String_Node_Str");
return;
}
newInstance=new TreeObject((String)key,xfolder.getServerRoot(),TreeObject.CUSTOM_TYPE,null,null);
break;
}
default :
return;
}
{
LocalTreeObjectRepository.getInstance().mergeNewTreeObject(newInstance);
XObjectEditor editpart=(XObjectEditor)view.getSite().getWorkbenchWindow().getActivePage().openEditor(new XObjectEditorInput(newInstance,newInstance.getDisplayName()),"String_Node_Str");
if (editpart.getSelectedPage() instanceof AMainPageV2) {
((AMainPageV2)editpart.getSelectedPage()).markDirty();
}
if (editpart.getSelectedPage() instanceof AMainPage) ((AMainPage)editpart.getSelectedPage()).markDirty();
}
}
 catch (Exception e) {
e.printStackTrace();
MessageDialog.openError(view.getSite().getShell(),"String_Node_Str","String_Node_Str" + IConstants.TALEND + "String_Node_Str"+ e.getLocalizedMessage());
}
}