Skip to content

Commit

Permalink
adding warning dialog for empty project and fixing minor display issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Horváth Dávid committed Jun 4, 2021
1 parent 98838e5 commit 2c13eb8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public IJavaProject getSelectedProject() {
throw new WrongSelectionException("Non-resources selected.");
}
IProject project = resource.getProject();
if (!project.isOpen()) {
throw new WrongSelectionException("The selected project is closed. Please open the project before starting an iFL session.");
}
if (EU.tryUnchecked(() -> project.isNatureEnabled(Natures.JAVA.getValue()))) {
return JavaCore.create(project);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,18 @@ public void widgetDefaultSelected(SelectionEvent e) {

scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL);
GridData gd_scrolledComposite = new GridData(SWT.CENTER, SWT.CENTER, false, false, 3, 1);
gd_scrolledComposite.widthHint = 360;
gd_scrolledComposite.widthHint = 320;
gd_scrolledComposite.heightHint = 280;
scrolledComposite.setLayoutData(gd_scrolledComposite);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);

rulesComposite = new Composite(scrolledComposite, SWT.NONE);
rulesComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
rulesComposite.setSize(new Point(360, 280));
rulesComposite.setSize(new Point(320, 280));
rulesComposite.setLayout(new GridLayout(1, false));
scrolledComposite.setContent(rulesComposite);
scrolledComposite.setMinSize(rulesComposite.getSize());
scrolledComposite.setMinSize(new Point(320, 280));

System.out.println(rules.size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ public CodeElementUI(Composite parent, int style,
nameKeyLabel.setText("Name:");

nameValueLabel = new Text(this, SWT.READ_ONLY);
nameValueLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
GridData gd_nameValueLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_nameValueLabel.widthHint = 140;
nameValueLabel.setLayoutData(gd_nameValueLabel);
nameValueLabel.setText(name);

signatureIcon = new Label(this, SWT.NONE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.eclipse.sed.ifl.ide.gui.element;

import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;

import org.eclipse.sed.ifl.control.score.filter.BooleanRule;
import org.eclipse.sed.ifl.control.score.filter.DoubleRule;
import org.eclipse.sed.ifl.control.score.filter.LastActionRule;
Expand All @@ -26,6 +31,9 @@

public class RuleElementUI extends Composite {

private static final DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
private static final DecimalFormat LIMIT_FORMAT = new DecimalFormat("#0.0000", symbols);

private Rule rule;

public Rule getRule() {
Expand Down Expand Up @@ -92,6 +100,7 @@ public void widgetDefaultSelected(SelectionEvent e) {

resultsValueLabel = new Label(this, SWT.NONE);
resultsValueLabel.setText("-");
new Label(this, SWT.NONE);

addDisposeListener(new DisposeListener() {

Expand All @@ -117,7 +126,8 @@ private String setRuleValueLabelText() {
negatedString = "not ";
}
switch(this.rule.getDomain()) {
case "Score": rString = ((DoubleRule)this.rule).getRelation().concat(" ").concat(Double.toString(((DoubleRule)this.rule).getValue()));
case "Score": LIMIT_FORMAT.setRoundingMode(RoundingMode.DOWN);
rString = ((DoubleRule)this.rule).getRelation().concat(" ").concat(LIMIT_FORMAT.format(((DoubleRule)this.rule).getValue()));
icon = ResourceManager.getPluginImage("org.eclipse.sed.ifl", "icons/rule_score_3.png");
break;
case "Name":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public IntegerRuleCreator(Composite parent, String domain) {
enterValueLabel.setText("Enter value:");

spinner = new Spinner(composite, SWT.BORDER);
spinner.setMaximum(10000);
spinner.setMaximum(Integer.MAX_VALUE);

Label addRelationLabel = new Label(composite, SWT.NONE);
addRelationLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.eclipse.sed.ifl.feature"
label="iFL for Eclipse"
version="3.4.0.0"
version="3.4.205.1"
provider-name="University of Szeged Department of Software Engineering">

<description url="https://github.com/sed-szeged/iFL4Eclipse">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/org.eclipse.sed.ifl.feature_3.1.0.0.jar" id="org.eclipse.sed.ifl.feature" version="3.4.0.0">
<feature url="features/org.eclipse.sed.ifl.feature_3.1.0.0.jar" id="org.eclipse.sed.ifl.feature" version="3.4.205.1">
<category name="iFL for Eclipse"/>
</feature>
<category-def name="iFL for Eclipse" label="iFL for Eclipse"/>
Expand Down

0 comments on commit 2c13eb8

Please sign in to comment.