Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class RunCogniCryptAction extends CogniCryptAction implements DumbAware
private static final Logger logger = Logger.getInstance(RunCogniCryptAction.class);
private final IPersistableCogniCryptSettings _settings;
private final IdeType _ideType;
public static boolean EnabledFlag= true;

public RunCogniCryptAction()
{
Expand All @@ -49,6 +50,12 @@ public void actionPerformed(@NotNull AnActionEvent e)
Iterable<File> files = GetFilesToAnalyze(project);

// TODO: Re-Enable
if(e.getPresentation().isEnabled()){
e.getPresentation().setEnabled(false);
EnabledFlag=false;
update(e);
}

/*
if (files == null || !Linq.any(files))
{
Expand Down Expand Up @@ -87,6 +94,14 @@ private Iterable<File> GetFilesToAnalyze(Project project)
}
return Collections.EMPTY_LIST;
}
public static void SetFlag(boolean b){
EnabledFlag=b;
}
@Override
public void update(AnActionEvent e) {
e.getPresentation().setEnabled(EnabledFlag);
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import crypto.interfaces.ISLConstraint;
import crypto.rules.CrySLPredicate;
import de.fraunhofer.iem.icognicrypt.Constants;
import de.fraunhofer.iem.icognicrypt.actions.RunCogniCryptAction;
import de.fraunhofer.iem.icognicrypt.core.Language.JvmClassNameUtils;
import de.fraunhofer.iem.icognicrypt.results.CogniCryptError;
import de.fraunhofer.iem.icognicrypt.results.IResultProvider;
Expand All @@ -29,7 +30,6 @@
import soot.SootClass;
import sync.pds.solver.nodes.Node;
import typestate.TransitionFunction;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand All @@ -43,6 +43,7 @@ class AnalysisListenerService extends CrySLAnalysisListener implements Disposabl
private static final Logger logger = LoggerFactory.getLogger(AnalysisListenerService.class);
private final Project _project;
private IResultProvider _resultProvider;
public static boolean EnabledFlag;

private final List<String> _sourceCodeFiles;

Expand All @@ -54,6 +55,7 @@ private AnalysisListenerService(Project project, IResultProvider resultProvider)

@Override
public void beforeAnalysis() {
EnabledFlag= false;
_resultProvider.RemoveAllResults();
_sourceCodeFiles.clear();

Expand All @@ -66,6 +68,7 @@ public void afterAnalysis() {
//After analysis completes, restart code analyzer so that error markers can be updated
//for (Project project : ProjectManager.getInstance().getOpenProjects())
DaemonCodeAnalyzer.getInstance(_project).restart();
RunCogniCryptAction.SetFlag(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import crypto.analysis.errors.IncompleteOperationError;
import de.fraunhofer.iem.crypto.CogniCryptAndroidAnalysis;
import de.fraunhofer.iem.icognicrypt.Constants;
import de.fraunhofer.iem.icognicrypt.actions.RunCogniCryptAction;
import de.fraunhofer.iem.icognicrypt.core.Language.JvmClassNameUtils;
import de.fraunhofer.iem.icognicrypt.results.CogniCryptError;
import de.fraunhofer.iem.icognicrypt.results.IResultProvider;
Expand Down Expand Up @@ -111,6 +112,7 @@ public void onFinished()
_analysisQueue = null;
_stopWatch = null;
_resultProvider = null;
RunCogniCryptAction.SetFlag(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public static void RunIntelliJAnalysis(Project project, Iterable<File> filesToAn
Task analysis = new JavaProjectAnalysisTask(modulePath, Joiner.on(File.pathSeparator).join(classpath),
settings.getRulesDirectory());
ProgressManager.getInstance().run(analysis);

*/

}

ProgressManager.getInstance().run(new JavaProjectAnalysisTask(project, modulePaths
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public CogniCryptResultWindow(ToolWindow toolWindow, Project project)
IResultProvider service = ServiceManager.getService(project, IResultProvider.class);
service.Subscribe(_tableModel);


for (Set<CogniCryptError> errorSet : service.GetErrors().values())
{
for (CogniCryptError error : errorSet)
{
_tableModel.AddError(error);
}
}
// ToolWindow clearing when starting IDE
// for (Set<CogniCryptError> errorSet : service.GetErrors().values())
// {
// for (CogniCryptError error : errorSet)
// {
// _tableModel.AddError(error);
// }
// }
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package de.fraunhofer.iem.icognicrypt.ui;

import com.intellij.ide.DataManager;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import static de.fraunhofer.iem.icognicrypt.IdeSupport.projects.ProjectHelper.GetActiveProject;


public class NotificationProvider
{

public static void Warn(String message)
{
ShowNotification(message, NotificationType.WARNING);
Expand All @@ -24,6 +31,13 @@ public static void ShowError(String message)
private static void ShowNotification(String message, NotificationType type)
{
Notification notification = new Notification("CogniCrypt", "CogniCrypt Message", message, type);
Notifications.Bus.notify(notification);
Project project= GetActiveProject();
DataContext d = DataManager.getInstance().getDataContext();
Project project1= d.getData(PlatformDataKeys.PROJECT);
if(project==project1) {
Notifications.Bus.notify(notification, project);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
<children>
<component id="1c0ef" class="javax.swing.JList" binding="_filesListBox">
<constraints/>
<properties/>
<properties>
<model/>
</properties>
</component>
</children>
</scrollpane>
Expand Down