[logback-dev] svn commit: r1479 - in logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse: dialog model views
noreply.seb at qos.ch
noreply.seb at qos.ch
Wed Mar 28 21:09:11 CEST 2007
Author: seb
Date: Wed Mar 28 21:09:11 2007
New Revision: 1479
Modified:
logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackFilterDialog.java
logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/model/EventFilter.java
logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java
Log:
Added buttons to re-order filters
Modified: logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackFilterDialog.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackFilterDialog.java (original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackFilterDialog.java Wed Mar 28 21:09:11 2007
@@ -51,7 +51,7 @@
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
- container.setSize(1000, 3000);
+ container.setSize(900, 3000);
FillLayout layout = new FillLayout();
layout.type = SWT.VERTICAL;
@@ -59,8 +59,9 @@
createTable(container);
Composite editComposite = new Composite(container, SWT.BORDER);
- editComposite.setSize(1000, 1000);
+ editComposite.setSize(900, 1000);
createEditionUIPart(editComposite);
+ createButtons(editComposite);
return container;
}
@@ -71,38 +72,69 @@
container.setLayout(gridLayout);
final Label infoLabel = new Label(container, SWT.NONE);
- infoLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
+ infoLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
infoLabel.setText("Enter java code in the expression field.");
+ final Button moveUp = new Button(container, SWT.PUSH);
+ moveUp.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false, 1, 1));
+ moveUp.setText("Up");
+ moveUp.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ EventFilter.moveFilterUp(current);
+ viewer.refresh();
+ }
+ });
+
final Label infoLabel2 = new Label(container, SWT.NONE);
- infoLabel2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
+ infoLabel2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
infoLabel2.setText("Enter ACCEPT, DENY or NEUTRAL in the other two fields.");
+ final Button moveDown = new Button(container, SWT.PUSH);
+ moveDown.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false, 1, 1));
+ moveDown.setText("Down");
+ moveDown.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ EventFilter.moveFilterDown(current);
+ viewer.refresh();
+ }
+ });
expressionField = new Text(container, SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.heightHint = 75;
- gridData.widthHint = 300;
+ gridData.widthHint = 320;
gridData.horizontalSpan = 3;
gridData.verticalSpan = 2;
expressionField.setLayoutData(gridData);
- final Label infoLabel3 = new Label(container, SWT.NONE);
- infoLabel3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
+ Composite cmp = new Composite(container, SWT.NONE);
+ cmp.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
+ GridLayout grd = new GridLayout();
+ grd.numColumns = 2;
+ cmp.setLayout(grd);
+ final Label infoLabel3 = new Label(cmp, SWT.NONE);
+ infoLabel3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));
infoLabel3.setText("Action on filter match");
- matchField = new Text(container, SWT.BORDER);
- Rectangle bounds2 = matchField.getBounds();
- bounds2.width = 150;
+ matchField = new Text(cmp, SWT.BORDER);
+// Rectangle bounds2 = matchField.getBounds();
+// bounds2.width = 150;
matchField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
- final Label infoLabel4 = new Label(container, SWT.NONE);
- infoLabel4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
+ final Label infoLabel4 = new Label(cmp, SWT.NONE);
+ infoLabel4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));
infoLabel4.setText("Action on filter mismatch");
- mismatchField = new Text(container, SWT.BORDER);
- Rectangle bounds3 = mismatchField.getBounds();
- bounds3.width = 150;
+ mismatchField = new Text(cmp, SWT.BORDER);
+// Rectangle bounds3 = mismatchField.getBounds();
+// bounds3.width = 150;
mismatchField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
-
+ }
+
+ private void createButtons(Composite container) {
+
final Button saveButton = new Button(container, SWT.PUSH);
saveButton.setText("Save");
saveButton.addSelectionListener(new SelectionAdapter() {
@@ -182,7 +214,6 @@
expressionField.setText(eval.getExpression());
matchField.setText(current.getOnMatch().toString());
mismatchField.setText(current.getOnMismatch().toString());
-
}
private void saveCurrentFilter() {
Modified: logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/model/EventFilter.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/model/EventFilter.java (original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/model/EventFilter.java Wed Mar 28 21:09:11 2007
@@ -101,4 +101,20 @@
}
}
+ public static void moveFilterUp(EvaluatorFilter filter) {
+ int index = filterList.indexOf(filter);
+ if (index > 0) {
+ filterList.remove(filter);
+ filterList.add(index-1, filter);
+ }
+ }
+
+ public static void moveFilterDown(EvaluatorFilter filter) {
+ int index = filterList.indexOf(filter);
+ if (index < filterList.size()-1) {
+ filterList.remove(filter);
+ filterList.add(index+1, filter);
+ }
+ }
+
}
Modified: logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java (original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java Wed Mar 28 21:09:11 2007
@@ -213,8 +213,10 @@
if (SimpleSocketServer.isPortFree(port)) {
server.stop();
openAndCloseClientToServer();
- serverThread.interrupt();
- serverThread = null;
+ if (serverThread != null) {
+ serverThread.interrupt();
+ serverThread = null;
+ }
server.setPort(port);
startServerThread(server);
}
More information about the logback-dev
mailing list