Skip to content

Commit

Permalink
Fix: Avoid exception log while parsing templates url
Browse files Browse the repository at this point in the history
  • Loading branch information
kolipakakondal committed Apr 15, 2021
1 parent 6f88db5 commit 317c5c7
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,21 @@
import com.espressif.idf.core.IDFCorePlugin;
import com.espressif.idf.core.logging.Logger;

public class FormBrowser {
public class FormBrowser
{
FormToolkit toolkit;
Composite container;
Browser formText;
String text;
int style;

public FormBrowser(int style) {
public FormBrowser(int style)
{
this.style = style;
}

public void createControl(Composite parent) {
public void createControl(Composite parent)
{
toolkit = new FormToolkit(parent.getDisplay());
int borderStyle = toolkit.getBorderStyle() == SWT.BORDER ? SWT.NULL : SWT.BORDER;
container = new Composite(parent, borderStyle);
Expand All @@ -63,7 +66,7 @@ public void changing(LocationEvent event)
PartInitException
| MalformedURLException e)
{
Logger.log(e);
// no need to report
}
formText.setText(text);
}
Expand All @@ -77,7 +80,8 @@ public void changed(LocationEvent event)
};
formText.addLocationListener(locationListener);

if (borderStyle == SWT.NULL) {
if (borderStyle == SWT.NULL)
{
formText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
toolkit.paintBordersFor(container);
}
Expand All @@ -88,7 +92,8 @@ public void changed(LocationEvent event)
ftext.marginHeight = 2;
ftext.setHyperlinkSettings(toolkit.getHyperlinkGroup());
formText.addDisposeListener(e -> {
if (toolkit != null) {
if (toolkit != null)
{
toolkit.dispose();
toolkit = null;
}
Expand All @@ -97,7 +102,8 @@ public void changed(LocationEvent event)
formText.setText(text);
}

public Control getControl() {
public Control getControl()
{
return container;
}

Expand All @@ -111,7 +117,8 @@ public void setText(String text)
}
catch (Exception e)
{
Status status = new Status(IStatus.ERROR, IDFCorePlugin.PLUGIN_ID, "Error parsing the template description", e); //$NON-NLS-1$
Status status = new Status(IStatus.ERROR, IDFCorePlugin.PLUGIN_ID,
"Error parsing the template description", e); //$NON-NLS-1$
IDFCorePlugin.getPlugin().getLog().log(status);
}
}
Expand Down

0 comments on commit 317c5c7

Please sign in to comment.