1 package com.proalpha.pds.util;
3 import java.text.SimpleDateFormat;
5 import java.util.Iterator;
7 import org.eclipse.jface.dialogs.MessageDialog;
8 import org.eclipse.jface.viewers.ISelection;
9 import org.eclipse.jface.viewers.IStructuredSelection;
10 import org.eclipse.ui.PlatformUI;
12 import com.openedge.pdt.project.OEProjectPlugin;
13 import com.proalpha.pds.exception.ProALPHANotAvailableException;
14 import com.proalpha.pds.jaxb.DsDSConsistencyChecks.TtDSCheck.TtDSSubCheck.TtDSLogEntryRepos;
15 import com.proalpha.pds.paconnector.Activator;
16 import com.proalpha.pds.paconnector.PaProject;
17 import com.proalpha.pds.paconnector.RunProgramInPa;
21 public void add(ISelection selection, String paProjectName) {
23 Iterator<?> it = ((IStructuredSelection) selection).iterator();
25 while (it.hasNext()) {
29 if (
object instanceof TtDSLogEntryRepos) {
30 TtDSLogEntryRepos entryRepos = (TtDSLogEntryRepos)
object;
33 OEProjectPlugin.getDefault().getOpenEdgeModel().getOpenEdgeProject(paProjectName));
35 if (currentProject !=
null && currentProject.isAvailable()) {
39 SimpleDateFormat dateFormatter =
new SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
41 runPaProg.
runSupportProcedure(
"ds_oea35.p", entryRepos.getOwningObj(), entryRepos.getOwningID(),
42 entryRepos.getDSCheckID(), entryRepos.getDSSubCheckID(),
43 entryRepos.getLogEntryDescription(), entryRepos.getLastUser(),
"",
44 dateFormatter.format(
new Date()));
46 displayPaNotAvailableWarning(paProjectName);
50 displayPaNotAvailableWarning(paProjectName);
57 private void displayPaNotAvailableWarning(String paProjectName) {
58 MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
59 "Add to codecheckedby.xml not available",
60 "The selected project " + paProjectName +
" is not open. Add to codecheckedby.xml is only "
61 +
"accessible if the selected project is available.");
static Activator getDefault()
String runSupportProcedure(String supportProcedure, String... parameters)