Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e65aaa5
change checker_framework config, add JavaSE-11
GloriaWa Mar 2, 2020
4ec7aad
change file structure, add feature and update site
GloriaWa Mar 2, 2020
f5d416d
restore master
GloriaWa Mar 6, 2020
65e8f9e
restore master
GloriaWa Mar 6, 2020
28c278a
add JavaSE-11
GloriaWa Mar 6, 2020
3e79ea5
delete JavaSE-12, only have JavaSE-11 in MANIFEST.MF now
GloriaWa Mar 12, 2020
4977bdd
restore master branch
GloriaWa Mar 26, 2020
693ac03
restore master
GloriaWa Mar 26, 2020
b3386e2
Merge branch 'master' of https://github.com/eisopux/checker-framework…
GloriaWa Apr 10, 2020
eb25e8b
check if the zip file is not the downloader when initialing the langu…
GloriaWa Apr 10, 2020
80d619b
add feature and update site
GloriaWa Apr 10, 2020
b47e2f4
reverse plugin change
GloriaWa Apr 11, 2020
1f57ba5
change name
GloriaWa May 4, 2020
33df67d
update update site name
GloriaWa May 4, 2020
2ee8cd3
Merge branch 'add-more-checking-when-initializing-langserver' of gith…
wmdietl Jun 8, 2020
a7991b1
Use org.checkerframework.languageserver.eclipse as base name.
wmdietl Jun 13, 2020
55bb2e7
Add Eclipse Tycho configuration.
wmdietl Jun 13, 2020
66a91a6
Add Travis CI configuration.
wmdietl Jun 13, 2020
dc3fa21
Add .gitignore.
wmdietl Jun 13, 2020
ec859c1
Remove unused import. Fix typo.
wmdietl Jun 13, 2020
85c9ed2
Try to improve first-timer instructions.
wmdietl Jun 13, 2020
0221dbe
Set target platform. Enable ErrorProne.
wmdietl Jun 13, 2020
1d460ab
Disable ErrorProne. I also didn't get Spotless to work.
wmdietl Jun 13, 2020
a5b0a4b
Merge branch 'master' of https://github.com/64g/checker-framework-ecl…
Jul 1, 2020
6fff61e
Enable mutiple checkers and add dropdown list
Aug 5, 2020
e5c3f37
rollback .gitignore
Aug 5, 2020
0b1d3f5
fix by comments
Aug 12, 2020
1033cf1
fix all comments
Aug 13, 2020
dc70168
remove unsed import
Aug 13, 2020
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
17 changes: 17 additions & 0 deletions feature/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should finish #19 and add feature/update-site in separate PRs.

<projectDescription>
<name>lsp_checkerframework.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
8 changes: 8 additions & 0 deletions feature/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
bin.includes = feature.xml,\
bin/,\
plugin/,\
feature/
src.includes = feature.xml,\
build.properties,\
.project

396 changes: 396 additions & 0 deletions feature/feature.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.checkerframework.languageserver.eclipse;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
Expand All @@ -12,6 +17,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
Expand All @@ -23,10 +29,24 @@
*/
public class LSPCheckerFrameworkPreferencePage extends PreferencePage
implements IWorkbenchPreferencePage, SelectionListener, ModifyListener {

/**
* Creates built in checker map.
*
* @key Checkers' display names in the drop down list
* @value Checkers' full name to initialize the server
*/
final private Map<String, String> builtinCheckers = new HashMap<String, String>() {{
put("Nullness Checker", "org.checkerframework.checker.nullness.NullnessChecker");
put("Optional Checker", "org.checkerframework.checker.optional.OptionalChecker");
put("Regex Checker", "org.checkerframework.checker.regex");
put("Interning Checker", "org.checkerframework.checker.interning.InterningChecker");
}};

private Text textFieldTypeChecker;
private Text textFieldCheckerPath;
private Text textFieldCommandLineOptions;
private List multiSelectCheckerOptions;

/**
* Creates composite control and sets the default layout data.
Expand Down Expand Up @@ -62,6 +82,11 @@ protected Control createContents(Composite parent) {
createLabel(
composite_textField_typeChecker,
MessageUtil.getString("Text_Field_Type_Checker")); // $NON-NLS-1$

Composite composite_multiSelectDropdown_checker_options = createComposite(parent, 2);
createLabel(
composite_multiSelectDropdown_checker_options,
MessageUtil.getString("Dropdown_Checker_Options"));

Composite composite_textField_checkerPath = createComposite(parent, 2);
createLabel(
Expand All @@ -74,6 +99,7 @@ protected Control createContents(Composite parent) {
MessageUtil.getString("Text_Field_Command_Options")); // $NON-NLS-1$

textFieldTypeChecker = createTextField(composite_textField_typeChecker);
multiSelectCheckerOptions = createMultiSelectDropdown(composite_multiSelectDropdown_checker_options);
textFieldCheckerPath = createTextField(composite_textField_checkerPath);
textFieldCommandLineOptions = createTextField(composite_textField_commandOptions);

Expand Down Expand Up @@ -117,6 +143,22 @@ private Text createTextField(Composite parent) {
text.setLayoutData(data);
return text;
}

/**
* Create a multi-select list specific for this application
*
* @param parent the parent of the new text field
* @return the new multi-select list
*/
private List createMultiSelectDropdown(Composite parent) {
// Create a multiple-selection list
List multi = new List(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
for (String item : builtinCheckers.keySet()) {
multi.add(item);
}
multi.addSelectionListener(this);
return multi;
}

/**
* The <code>ReadmePreferencePage</code> implementation of this <code>PreferencePage</code> method
Expand Down Expand Up @@ -152,6 +194,57 @@ private void initializeValues() {
textFieldCheckerPath.setText(store.getString(LSPCheckerFrameworkConstants.CHECKER_PATH));
textFieldCommandLineOptions.setText(
store.getString(LSPCheckerFrameworkConstants.COMMAND_OPTIONS));

/** Initializes states of the multi-select list from the preference store. */
String[] checkersStored = store.getString(LSPCheckerFrameworkConstants.TYPE_CHECKER).split("\\,");
synchronizeMultiSelectListWithTextField(checkersStored);

/** Adds a listener to the multi-select list to synchronize inputed checkers from the text field. */
ModifyListener checkerMultiSelectListener = new ModifyListener() {
/** {@inheritDoc} */
public void modifyText(ModifyEvent e) {
// Handle event
String[] inputCheckers = textFieldTypeChecker.getText().split("\\,");
synchronizeMultiSelectListWithTextField(inputCheckers);
}
};
textFieldTypeChecker.addModifyListener(checkerMultiSelectListener);

/** Adds a listener to the text field to synchronize inputed checkers from the multi-select list. */
SelectionListener checkerTextFieldListener = new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
java.util.List<String> checkers = Arrays.asList(multiSelectCheckerOptions.getSelection());;
String result = checkers.stream()
.map(i -> builtinCheckers.get(i))
.collect(Collectors.joining(","));
textFieldTypeChecker.setText(result);
}

/** The multi-select list is initialized above in initializeValues() not need to set default again. */
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {}

};
multiSelectCheckerOptions.addSelectionListener(checkerTextFieldListener);
}

private void synchronizeMultiSelectListWithTextField(String[] inputCheckersInTextField) {
multiSelectCheckerOptions.deselectAll();
/** Looping input checkers in text field */
for (String checkerFullName : inputCheckersInTextField) {
/** Looping built in checkers */
for (String checkerName : builtinCheckers.keySet()) {
if (checkerFullName.equals(builtinCheckers.get(checkerName))) {
/** Looping multi-select list to select the checkers */
for(int i = 0; i < multiSelectCheckerOptions.getItems().length; i++) {
if(multiSelectCheckerOptions.getItems()[i].equals(checkerName)) {
multiSelectCheckerOptions.select(i);
}
}
}
}
}
}

/** (non-Javadoc) Method declared on ModifyListener */
Expand Down Expand Up @@ -185,7 +278,7 @@ private void storeValues() {
store.setValue(
LSPCheckerFrameworkConstants.COMMAND_OPTIONS, textFieldCommandLineOptions.getText());
}

/** (non-Javadoc) Method declared on SelectionListener */
public void widgetDefaultSelected(SelectionEvent event) {
// Handle a default selection. Do nothing in this example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public LanguageServerStreamConnectionProvider() {
commands.add("--commandLineOptions");
commands.add(commandOptions);
}

setCommands(commands);
setWorkingDirectory(System.getProperty("user.dir"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Check_Box_Options=Check Box Options
Text_Field_Type_Checker=Type Checker
Text_Field_Checker_Path=Checker Path
Text_Field_Command_Options=Command Line Options
Dropdown_Checker_Options=Built-in Checkers:
17 changes: 17 additions & 0 deletions update-site/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lsp_checkerframework.update_site</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.UpdateSiteBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.UpdateSiteNature</nature>
</natures>
</projectDescription>
8 changes: 8 additions & 0 deletions update-site/site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/checker-framework-eclipse-feature_0.0.1.jar" id="checker-framework-eclipse-feature" version="0.0.1"/>
<category name="checker-framework-eclipse-update-site"/>
</feature>
<category-def name="checker-framework-eclipse-update-site" label="Pluggable Type-Checking"/>
</site>