Type-Insert on-the fly ohne Speichern funktioniert ohne dass der JavaTXCompiler gestertet wird.
This commit is contained in:
parent
f27ad61a8b
commit
80f0708218
@ -6,6 +6,9 @@ import java.util.stream.Collectors;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.management.relation.RoleUnresolved;
|
import javax.management.relation.RoleUnresolved;
|
||||||
|
|
||||||
|
import org.antlr.v4.parse.GrammarTreeVisitor.tokenSpec_return;
|
||||||
|
import org.antlr.v4.runtime.CommonToken;
|
||||||
|
import org.antlr.v4.runtime.Token;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
@ -25,10 +28,12 @@ import org.eclipse.swt.widgets.Display;
|
|||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
import org.eclipse.ui.IFileEditorInput;
|
import org.eclipse.ui.IFileEditorInput;
|
||||||
import org.eclipse.ui.editors.text.TextEditor;
|
import org.eclipse.ui.editors.text.TextEditor;
|
||||||
|
import org.eclipse.ui.internal.views.markers.MarkerContentGenerator;
|
||||||
import org.eclipse.ui.part.FileEditorInput;
|
import org.eclipse.ui.part.FileEditorInput;
|
||||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
|
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
|
||||||
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
||||||
|
import org.stringtemplate.v4.compiler.STParser.memberExpr_return;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
@ -37,6 +42,8 @@ import de.dhbwstuttgart.syntaxtree.SourceFile;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.typedeployment.TypeInsert;
|
import de.dhbwstuttgart.typedeployment.TypeInsert;
|
||||||
|
import de.dhbwstuttgart.typedeployment.TypeInsertFactory;
|
||||||
|
import de.dhbwstuttgart.typedeployment.TypeInsertPoint;
|
||||||
import de.dhbwstuttgart.typeinference.result.ResolvedType;
|
import de.dhbwstuttgart.typeinference.result.ResolvedType;
|
||||||
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.unify.UnifyResultEvent;
|
import de.dhbwstuttgart.typeinference.unify.UnifyResultEvent;
|
||||||
@ -245,6 +252,22 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
|
|||||||
|
|
||||||
typeReplaceMarkers.remove(typeReplaceMarker);
|
typeReplaceMarkers.remove(typeReplaceMarker);
|
||||||
|
|
||||||
|
int lengthOfInsert = typeReplaceMarker.getInsertPoint().getInsertString().length();
|
||||||
|
int line = typeReplaceMarker.getInsertPoint().point.point.getLine();
|
||||||
|
int posInLine = typeReplaceMarker.getInsertPoint().point.point.getCharPositionInLine();
|
||||||
|
|
||||||
|
for (TypeReplaceMarker marker : typeReplaceMarkers) {
|
||||||
|
if (marker.getInsertPoint().point.point.getStartIndex() > typeReplaceMarker.getInsertPoint().point.point.getStartIndex()) {
|
||||||
|
Token token = marker.getInsertPoint().point.getToken();
|
||||||
|
CommonToken newTok = new CommonToken(token);
|
||||||
|
newTok.setStartIndex(token.getStartIndex() + lengthOfInsert);
|
||||||
|
newTok.setStopIndex(token.getStopIndex() + lengthOfInsert);
|
||||||
|
newTok.setTokenIndex(token.getTokenIndex() + lengthOfInsert);
|
||||||
|
marker.getInsertPoint().point.setToken(newTok);
|
||||||
|
marker.getInsertPoint().point.setToken(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
removeVisualMarkers();
|
removeVisualMarkers();
|
||||||
updateGuiWithNewMarkers(typeReplaceMarkers);
|
updateGuiWithNewMarkers(typeReplaceMarkers);
|
||||||
/*
|
/*
|
||||||
@ -330,6 +353,7 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
|
|||||||
|
|
||||||
Set<JavMarker> markers = new HashSet<JavMarker>();
|
Set<JavMarker> markers = new HashSet<JavMarker>();
|
||||||
typeReplaceMarkers = typeinference.updateWithResult(new Vector(markers), evt.getNewTypeResult());
|
typeReplaceMarkers = typeinference.updateWithResult(new Vector(markers), evt.getNewTypeResult());
|
||||||
|
|
||||||
for (TypeReplaceMarker m : this.getTypeReplaceMarkers()) {
|
for (TypeReplaceMarker m : this.getTypeReplaceMarkers()) {
|
||||||
markers.add(m);
|
markers.add(m);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class JavOutline extends ContentOutlinePage{
|
|||||||
viewer.addSelectionChangedListener(this);
|
viewer.addSelectionChangedListener(this);
|
||||||
if(this.syntaxTree!=null)viewer.setInput(this.syntaxTree);
|
if(this.syntaxTree!=null)viewer.setInput(this.syntaxTree);
|
||||||
|
|
||||||
//ContextMenu für die TreeView:
|
//ContextMenu für die TreeView:
|
||||||
final MenuManager menuMgr = new MenuManager();
|
final MenuManager menuMgr = new MenuManager();
|
||||||
menuMgr.setRemoveAllWhenShown(true);
|
menuMgr.setRemoveAllWhenShown(true);
|
||||||
menuMgr.addMenuListener(new FillContextMenu(viewer, this));
|
menuMgr.addMenuListener(new FillContextMenu(viewer, this));
|
||||||
|
@ -25,12 +25,19 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.dhbwstuttgart</groupId>
|
<groupId>de.dhbwstuttgart</groupId>
|
||||||
<artifactId>JavaTXcompiler</artifactId>
|
<artifactId>JavaTXcompiler</artifactId>
|
||||||
<version>0.1</version>
|
<version>0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.antlr</groupId>
|
<groupId>org.antlr</groupId>
|
||||||
<artifactId>antlr4</artifactId>
|
<artifactId>antlr4</artifactId>
|
||||||
<version>4.7</version>
|
<version>4.7</version>
|
||||||
|
<!--exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.antlr</groupId>
|
||||||
|
<artifactId>antlr-runtime</artifactId>
|
||||||
|
<version>3.5.2</version>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions-->
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
@ -70,7 +77,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.dhbwstuttgart</groupId>
|
<groupId>de.dhbwstuttgart</groupId>
|
||||||
<artifactId>JavaTXcompiler</artifactId>
|
<artifactId>JavaTXcompiler</artifactId>
|
||||||
<version>0.1.0</version>
|
<version>0.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.antlr</groupId>
|
<groupId>org.antlr</groupId>
|
||||||
|
Loading…
Reference in New Issue
Block a user