Skip to content

Commit

Permalink
Version 0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
lcbarcellos committed Nov 23, 2020
2 parents 6119d77 + 0d0c9c5 commit 05f6c8d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>br.ufes.inf.nemo</groupId>
<artifactId>ufo-protege-plugin</artifactId>
<version>0.0.8</version>
<version>0.0.9</version>
<packaging>bundle</packaging>

<name>UFO Protégé Plugin</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import br.ufes.inf.nemo.ufo.protege.Singleton;
import br.ufes.inf.nemo.ufo.protege.sandbox.LogDocument;
import br.ufes.inf.nemo.ufo.protege.validation.Result;
import br.ufes.inf.nemo.ufo.protege.validation.Validation;
import br.ufes.inf.nemo.ufo.protege.validation.Validator;
import java.awt.event.ActionEvent;
import org.protege.editor.owl.model.OWLModelManager;
import org.protege.editor.owl.ui.action.ProtegeOWLAction;
import org.protege.editor.owl.ui.view.cls.ToldOWLClassHierarchyViewComponent;

Expand All @@ -21,27 +21,29 @@
*/
@EditorKitMenuAction(
id = "ufopp.validate.menuItem",
path = "org.protege.editor.core.application.menu.FileMenu/SlotAA-Z",
path = "br.ufes.inf.nemo.ufo-protege-plugin.PatternMenu/SlotB-A",
name = "Validate GUFO rules"
)
public class ValidateCommand extends ProtegeOWLAction {

ToldOWLClassHierarchyViewComponent test;

@Override
public void actionPerformed(ActionEvent ae) {
Validator validator = Validator.get(getOWLModelManager());
LogDocument logDocument = Singleton.get(
getOWLModelManager(), LogDocument.class);
public static void run(final OWLModelManager owlModelManager) {
Validator validator = Validator.get(owlModelManager);
LogDocument logDocument = Singleton.get(owlModelManager, LogDocument.class);
Result result = validator.validate();
logDocument.append(result.toString());
logDocument.append("\n");

ValidationResultDocument resultDocument = Singleton.get(
getOWLModelManager(), ValidationResultDocument.class);
ValidationResultDocument resultDocument = Singleton.get(owlModelManager, ValidationResultDocument.class);
resultDocument.setResult(result);
}

@Override
public void actionPerformed(ActionEvent ae) {
run(getOWLModelManager());
}

@Override
public void initialise() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import br.ufes.inf.nemo.ufo.protege.Singleton;
import br.ufes.inf.nemo.ufo.protege.Util;
import br.ufes.inf.nemo.ufo.protege.validation.Result;
import br.ufes.inf.nemo.ufo.protege.validation.Rule;
import br.ufes.inf.nemo.ufo.protege.validation.Violation;
import br.ufes.inf.nemo.ufo.protege.validation.helpers.ObjectGraphNode;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import javax.swing.event.HyperlinkEvent;
import static javax.swing.event.HyperlinkEvent.EventType.ACTIVATED;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.html.FormSubmitEvent;
import javax.swing.text.html.HTMLEditorKit;
import org.apache.log4j.Logger;
import org.protege.editor.owl.model.OWLModelManager;
import org.protege.editor.owl.model.OWLWorkspace;
Expand Down Expand Up @@ -52,6 +54,8 @@ protected void initialiseOWLView() throws Exception {
JTextPane resultTextPane = new JTextPane();
resultTextPane.setEditable(false);
resultTextPane.setContentType("text/html");
HTMLEditorKit kit = (HTMLEditorKit) resultTextPane.getEditorKit();
kit.setAutoFormSubmission(false);
resultTextPane.setDocument(resultDocument.getDocument());

JScrollPane resultTextScrollPane = new JScrollPane(resultTextPane);
Expand All @@ -65,7 +69,17 @@ protected void disposeOWLView() {

@Override
public void hyperlinkUpdate(HyperlinkEvent he) {
if (ACTIVATED == he.getEventType()) {
if (he instanceof FormSubmitEvent) {
final URL url = he.getURL();
if ("gufo.command".equals(url.getHost())) {
final OWLModelManager modelManager = getOWLModelManager();
switch (url.getPath()) {
case "/validate":
ValidateCommand.run(modelManager);
break;
}
}
} else if (ACTIVATED == he.getEventType()) {
final OWLModelManager modelManager = getOWLModelManager();
final OWLWorkspace workspace = getOWLWorkspace();
final OWLSelectionModel selection = workspace.getOWLSelectionModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
<style type="text/css">
.odd, .even {
padding: 5px;
background-color: #f8f8f8;
background-color: #fafafa;
border-bottom: 1px solid silver;
}
.odd {
background-color: #f2f2f2;
}
h1 {
background-color: silver;
}
ul {
color: blue;
background-color: #fdfdfd;
}
#header {
display: none;
background-color: #f0f0f0;
padding: 4px;
padding-left: 10px;
border: 1px solid gray;
border-radius: 2px;
}
</style>
</head>
<body id="body">
<div id="header">
<form action='https://gufo.command/validate'>
<input type='submit' value='Validate' />
</form>
<!--p>Filter: <input type="text" name="filter" value="Ok"></p-->
</div>

Expand Down

0 comments on commit 05f6c8d

Please sign in to comment.