-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from Krzmbrzl/plugin
0.5.0 Update
- Loading branch information
Showing
223 changed files
with
74,731 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+146 Bytes
(100%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicCodeEditor.class
Binary file not shown.
Binary file added
BIN
+1.03 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicCompletionProposal$1.class
Binary file not shown.
Binary file added
BIN
+1.3 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicCompletionProposal$2.class
Binary file not shown.
Binary file added
BIN
+5.34 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicCompletionProposal.class
Binary file not shown.
Binary file added
BIN
+4.1 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicContentAssistProcessor.class
Binary file not shown.
Binary file added
BIN
+1011 Bytes
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicInformationControl$1.class
Binary file not shown.
Binary file added
BIN
+1.48 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicInformationControl$2.class
Binary file not shown.
Binary file added
BIN
+1.91 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicInformationControl$3.class
Binary file not shown.
Binary file added
BIN
+765 Bytes
...n/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicInformationControl$InfoComposite.class
Binary file not shown.
Binary file added
BIN
+6.75 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicInformationControl.class
Binary file not shown.
Binary file added
BIN
+1.03 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicKeywordProvider$1.class
Binary file not shown.
Binary file added
BIN
+1.03 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicKeywordProvider$2.class
Binary file not shown.
Binary file modified
BIN
+213 Bytes
(130%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicKeywordProvider.class
Binary file not shown.
Binary file modified
BIN
+2.44 KB
(170%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicSourceViewerConfiguration.class
Binary file not shown.
Binary file added
BIN
+991 Bytes
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicTextHover$1.class
Binary file not shown.
Binary file added
BIN
+2.92 KB
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/BasicTextHover.class
Binary file not shown.
Binary file modified
BIN
-6 Bytes
(99%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/CharacterPairHandler$1.class
Binary file not shown.
Binary file modified
BIN
-17 Bytes
(100%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/CharacterPairHandler.class
Binary file not shown.
Binary file modified
BIN
+18 Bytes
(100%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/EditorKeyEventManager.class
Binary file not shown.
Binary file modified
BIN
+18 Bytes
(100%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/EditorKeyEventQueue.class
Binary file not shown.
Binary file modified
BIN
+53 Bytes
(120%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/IKeywordProvider.class
Binary file not shown.
Binary file modified
BIN
+532 Bytes
(110%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/KeywordScanner.class
Binary file not shown.
Binary file modified
BIN
-4 Bytes
(100%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/activator/Activator.class
Binary file not shown.
Binary file modified
BIN
+35 Bytes
(100%)
plugin/Raven.SQDev.Editors/bin/raven/sqdev/editors/sqdevEditor/SQDevFileEditor.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
222 changes: 222 additions & 0 deletions
222
plugin/Raven.SQDev.Editors/src/raven/sqdev/editors/BasicCompletionProposal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
package raven.sqdev.editors; | ||
|
||
import org.eclipse.core.runtime.Assert; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.jface.text.BadLocationException; | ||
import org.eclipse.jface.text.IDocument; | ||
import org.eclipse.jface.text.IInformationControl; | ||
import org.eclipse.jface.text.IInformationControlCreator; | ||
import org.eclipse.jface.text.contentassist.ICompletionProposal; | ||
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension3; | ||
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension5; | ||
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension6; | ||
import org.eclipse.jface.text.contentassist.IContextInformation; | ||
import org.eclipse.jface.viewers.StyledString; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.graphics.Image; | ||
import org.eclipse.swt.graphics.ImageData; | ||
import org.eclipse.swt.graphics.Point; | ||
import org.eclipse.swt.graphics.TextStyle; | ||
import org.eclipse.swt.widgets.Shell; | ||
import org.eclipse.ui.PlatformUI; | ||
|
||
import raven.sqdev.infoCollection.base.Keyword; | ||
import raven.sqdev.miscellaneous.AdditionalKeywordProposalInformation; | ||
import raven.sqdev.pluginManagement.ResourceManager; | ||
|
||
public class BasicCompletionProposal implements ICompletionProposal, ICompletionProposalExtension3, | ||
ICompletionProposalExtension5, ICompletionProposalExtension6 { | ||
|
||
/** | ||
* The image for all the SQF commands | ||
*/ | ||
private static final Image SQFCOMMAND_IMAGE = new Image(PlatformUI.getWorkbench().getDisplay(), | ||
new ImageData(ResourceManager.getManager() | ||
.getInternalResourceStream(ResourceManager.SQFCOMMAND_ICON))); | ||
|
||
/** The string to be displayed in the completion proposal popup. */ | ||
private String displayString; | ||
/** The replacement string. */ | ||
private String replacementString; | ||
/** The replacement offset. */ | ||
private int replacementOffset; | ||
/** The replacement length. */ | ||
private int replacementLength; | ||
/** The cursor position after this proposal has been applied. */ | ||
private int cursorPosition; | ||
/** The image to be displayed in the completion proposal popup. */ | ||
private Image image; | ||
/** The context information of this proposal. */ | ||
private IContextInformation contextInformation; | ||
/** The additional info of this proposal. */ | ||
private Object additionalProposalInfo; | ||
|
||
/** | ||
* Creates a <code>CompletionProposal</code> based on the given | ||
* <code>Keyword</code> | ||
* | ||
* @param keyword | ||
* The respective <code>Keyword</code> this proposal should be | ||
* craeted for | ||
* @param replacementOffset | ||
* The offset of the text to be replaced | ||
* @param replacementLength | ||
* The length of the text to be replaced | ||
*/ | ||
public BasicCompletionProposal(Keyword keyword, int replacementOffset, int replacementLength) { | ||
// create instance according to the keyword | ||
this(keyword.getKeyword(), replacementOffset, replacementLength, | ||
keyword.getKeyword().length(), SQFCOMMAND_IMAGE, keyword.getKeyword(), null, | ||
new AdditionalKeywordProposalInformation(keyword)); | ||
} | ||
|
||
/** | ||
* Creates a new completion proposal based on the provided information. The | ||
* replacement string is considered being the display string too. All | ||
* remaining fields are set to <code>null</code>. | ||
* | ||
* @param replacementString | ||
* the actual string to be inserted into the document | ||
* @param replacementOffset | ||
* the offset of the text to be replaced | ||
* @param replacementLength | ||
* the length of the text to be replaced | ||
* @param cursorPosition | ||
* the position of the cursor following the insert relative to | ||
* replacementOffset | ||
*/ | ||
public BasicCompletionProposal(String replacementString, int replacementOffset, | ||
int replacementLength, int cursorPosition) { | ||
this(replacementString, replacementOffset, replacementLength, cursorPosition, null, null, | ||
null, null); | ||
} | ||
|
||
/** | ||
* Creates a new completion proposal. All fields are initialized based on | ||
* the provided information. | ||
* | ||
* @param replacementString | ||
* the actual string to be inserted into the document | ||
* @param replacementOffset | ||
* the offset of the text to be replaced | ||
* @param replacementLength | ||
* the length of the text to be replaced | ||
* @param cursorPosition | ||
* the position of the cursor following the insert relative to | ||
* replacementOffset | ||
* @param image | ||
* the image to display for this proposal | ||
* @param displayString | ||
* the string to be displayed for the proposal | ||
* @param contextInformation | ||
* the context information associated with this proposal | ||
* @param additionalProposalInfo | ||
* the additional information associated with this proposal | ||
*/ | ||
public BasicCompletionProposal(String replacementString, int replacementOffset, | ||
int replacementLength, int cursorPosition, Image image, String displayString, | ||
IContextInformation contextInformation, Object additionalProposalInfo) { | ||
Assert.isNotNull(replacementString); | ||
Assert.isTrue(replacementOffset >= 0); | ||
Assert.isTrue(replacementLength >= 0); | ||
Assert.isTrue(cursorPosition >= 0); | ||
|
||
this.replacementString = replacementString; | ||
this.replacementOffset = replacementOffset; | ||
this.replacementLength = replacementLength; | ||
this.cursorPosition = cursorPosition; | ||
this.image = image; | ||
this.displayString = displayString; | ||
this.contextInformation = contextInformation; | ||
this.additionalProposalInfo = additionalProposalInfo; | ||
} | ||
|
||
/* | ||
* @see ICompletionProposal#apply(IDocument) | ||
*/ | ||
public void apply(IDocument document) { | ||
try { | ||
document.replace(replacementOffset, replacementLength, replacementString); | ||
} catch (BadLocationException x) { | ||
// ignore | ||
} | ||
} | ||
|
||
/* | ||
* @see ICompletionProposal#getSelection(IDocument) | ||
*/ | ||
public Point getSelection(IDocument document) { | ||
return new Point(replacementOffset + cursorPosition, 0); | ||
} | ||
|
||
/* | ||
* @see ICompletionProposal#getContextInformation() | ||
*/ | ||
public IContextInformation getContextInformation() { | ||
return contextInformation; | ||
} | ||
|
||
/* | ||
* @see ICompletionProposal#getImage() | ||
*/ | ||
public Image getImage() { | ||
return image; | ||
} | ||
|
||
/* | ||
* @see ICompletionProposal#getDisplayString() | ||
*/ | ||
public String getDisplayString() { | ||
if (displayString != null) | ||
return displayString; | ||
return replacementString; | ||
} | ||
|
||
@Override | ||
public IInformationControlCreator getInformationControlCreator() { | ||
return new IInformationControlCreator() { | ||
public IInformationControl createInformationControl(Shell parent) { | ||
return new BasicInformationControl(parent); | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public int getPrefixCompletionStart(IDocument document, int completionOffset) { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
@Override | ||
public String getAdditionalProposalInfo() { | ||
// does not get called | ||
return additionalProposalInfo.toString(); | ||
} | ||
|
||
@Override | ||
public Object getAdditionalProposalInfo(IProgressMonitor monitor) { | ||
return additionalProposalInfo; | ||
} | ||
|
||
@Override | ||
public StyledString getStyledDisplayString() { | ||
StyledString str = new StyledString(displayString); | ||
|
||
str.setStyle(0, replacementLength, new StyledString.Styler() { | ||
|
||
@Override | ||
public void applyStyles(TextStyle textStyle) { | ||
textStyle.foreground = PlatformUI.getWorkbench().getDisplay() | ||
.getSystemColor(SWT.COLOR_BLUE); | ||
} | ||
}); | ||
|
||
return str; | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
plugin/Raven.SQDev.Editors/src/raven/sqdev/editors/BasicContentAssistProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package raven.sqdev.editors; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.eclipse.jface.text.ITextViewer; | ||
import org.eclipse.jface.text.contentassist.CompletionProposal; | ||
import org.eclipse.jface.text.contentassist.ICompletionProposal; | ||
import org.eclipse.jface.text.contentassist.IContentAssistProcessor; | ||
import org.eclipse.jface.text.contentassist.IContextInformation; | ||
import org.eclipse.jface.text.contentassist.IContextInformationValidator; | ||
|
||
import raven.sqdev.infoCollection.base.Keyword; | ||
import raven.sqdev.util.EditorUtil; | ||
|
||
/** | ||
* A basic implementation of an <code>IContentAssistProcessor</code> using the | ||
* keywords provided by the {@linkplain BasicKeywordProvider} to generate | ||
* content assist for them | ||
* | ||
* @author Raven | ||
* | ||
*/ | ||
public class BasicContentAssistProcessor implements IContentAssistProcessor { | ||
/** | ||
* The editor this processor is working on | ||
*/ | ||
protected BasicCodeEditor editor; | ||
|
||
public BasicContentAssistProcessor(BasicCodeEditor editor) { | ||
this.editor = editor; | ||
} | ||
|
||
@Override | ||
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { | ||
String prefix = EditorUtil.getWordPartBeforeOffset(viewer.getDocument(), offset); | ||
|
||
List<Keyword> keywords; | ||
// get the respective list of keywords | ||
if (prefix.isEmpty()) { | ||
keywords = editor.getBasicConfiguration().getKeywordScanner().getKeywordProvider() | ||
.getKeywordList().getKeywords(); | ||
} else { | ||
keywords = editor.getBasicConfiguration().getKeywordScanner().getKeywordProvider() | ||
.getKeywordList().getListFor(prefix.charAt(0)); | ||
} | ||
|
||
ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); | ||
|
||
// create proposals | ||
for (Keyword currentKeyword : keywords) { | ||
if (currentKeyword.getKeyword().toLowerCase().startsWith(prefix.toLowerCase())) { | ||
// add a proposal | ||
proposals.add(new BasicCompletionProposal(currentKeyword, offset - prefix.length(), | ||
prefix.length())); | ||
} | ||
} | ||
|
||
if (proposals.size() > 0) { | ||
return proposals.toArray(new ICompletionProposal[proposals.size()]); | ||
} else { | ||
return new ICompletionProposal[] { new CompletionProposal("", offset, 0, 0, null, | ||
"No proposals available!", null, null) }; | ||
} | ||
} | ||
|
||
@Override | ||
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public char[] getCompletionProposalAutoActivationCharacters() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public char[] getContextInformationAutoActivationCharacters() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getErrorMessage() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public IContextInformationValidator getContextInformationValidator() { | ||
return null; | ||
} | ||
|
||
} |
Oops, something went wrong.