You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
4.3 KiB
102 lines
4.3 KiB
package com.teamcenter.rac.workflow.commands.newprocess;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
import com.teamcenter.rac.aifrcp.AifrcpPlugin;
|
|
import com.teamcenter.rac.common.AbstractTCCommandDialog;
|
|
import com.teamcenter.rac.kernel.TCComponentProcessType;
|
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
import com.teamcenter.rac.services.ISelectionMediatorService;
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
import com.teamcenter.rac.util.OSGIUtil;
|
|
import com.teamcenter.rac.util.Registry;
|
|
import com.teamcenter.rac.workflow.processdesigner.plugin.Activator;
|
|
import java.awt.Frame;
|
|
import javax.swing.SwingUtilities;
|
|
import org.apache.log4j.Logger;
|
|
import org.eclipse.swt.widgets.Display;
|
|
|
|
public class NewProcessCommand extends AbstractAIFCommand {
|
|
public TCSession session;
|
|
|
|
public final Frame parentFrame;
|
|
|
|
public InterfaceAIFComponent[] targetArray;
|
|
|
|
private static final Logger logger = Logger.getLogger(NewProcessCommand.class);
|
|
|
|
private InterfaceAIFComponent[] targetComps;
|
|
|
|
private AbstractAIFApplication m_app;
|
|
|
|
public String m_value_CR_allow_alternate_procedures = null;
|
|
|
|
public NewProcessCommand(Frame paramFrame, AbstractAIFApplication paramAbstractAIFApplication) {
|
|
this(paramFrame, paramAbstractAIFApplication, null);
|
|
}
|
|
|
|
public NewProcessCommand(final Frame parent, AbstractAIFApplication paramAbstractAIFApplication, InterfaceAIFComponent[] paramArrayOfInterfaceAIFComponent) {
|
|
System.out.println("ÕýÌ©--------------------------------------------¡¶¡¶¡·¡·¡·¡·¡·¡·");
|
|
this.m_app = paramAbstractAIFApplication;
|
|
InterfaceAIFComponent[] arrayOfInterfaceAIFComponent = paramArrayOfInterfaceAIFComponent;
|
|
this.parentFrame = parent;
|
|
if (arrayOfInterfaceAIFComponent != null) {
|
|
this.targetComps = arrayOfInterfaceAIFComponent;
|
|
} else {
|
|
Display.getDefault().syncExec(new Runnable() {
|
|
@Override
|
|
public void run() { NewProcessCommand.this.targetComps = NewProcessCommand.this.getSelectedTargetComponents(); }
|
|
});
|
|
}
|
|
try {
|
|
this.session = (TCSession)Activator.getDefault().getSession();
|
|
} catch (Exception exception) {
|
|
logger.error(exception.getClass().getName(), exception);
|
|
}
|
|
try {
|
|
TCComponentProcessType tCComponentProcessType = (TCComponentProcessType)this.session.getTypeComponent("EPMJob");
|
|
this.targetArray = tCComponentProcessType.validateProposedAttachments(this.targetComps, 1);
|
|
} catch (Exception exception) {
|
|
MessageBox.post(parent, exception);
|
|
return;
|
|
}
|
|
getallowAlternateProceduresPreference();
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
Registry registry = Registry.getRegistry(this);
|
|
AbstractTCCommandDialog abstractTCCommandDialog = (AbstractTCCommandDialog)registry.newInstanceFor("newProcessDialog", new Object[] { NewProcessCommand.this });
|
|
if (abstractTCCommandDialog != null) {
|
|
NewProcessCommand.this.setRunnable(abstractTCCommandDialog);
|
|
try {
|
|
NewProcessCommand.this.executeModeless();
|
|
} catch (Exception exception) {
|
|
exception.printStackTrace();
|
|
}
|
|
} else {
|
|
MessageBox.post(parent, registry.getString("failFindDialog"), registry.getString("error.TITLE"), 1);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
private InterfaceAIFComponent[] getSelectedTargetComponents() {
|
|
if (this.m_app != null)
|
|
return this.m_app.getTargetComponents();
|
|
ISelectionMediatorService iSelectionMediatorService = (ISelectionMediatorService)OSGIUtil.getService(AifrcpPlugin.getDefault(), ISelectionMediatorService.class);
|
|
return iSelectionMediatorService.getTargetComponents();
|
|
}
|
|
|
|
private void getallowAlternateProceduresPreference() { SwingUtilities.invokeLater(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
TCPreferenceService tCPreferenceService = NewProcessCommand.this.session.getPreferenceService();
|
|
NewProcessCommand.this.m_value_CR_allow_alternate_procedures = tCPreferenceService.getStringValue("CR_allow_alternate_procedures");
|
|
}
|
|
}); }
|
|
}
|
|
|
|
|