-package oic.simulator.serviceprovider.view.dialogs;
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import oic.simulator.serviceprovider.model.AttributeHelper;
-import oic.simulator.serviceprovider.utils.Constants;
-import oic.simulator.serviceprovider.utils.Utility;
+package oic.simulator.serviceprovider.view.dialogs;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
-import org.oic.simulator.AttributeProperty.Type;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import oic.simulator.serviceprovider.model.AttributeHelper;
+import oic.simulator.serviceprovider.model.AttributeHelper.ValidValuesType;
+import oic.simulator.serviceprovider.utils.Constants;
+import oic.simulator.serviceprovider.utils.Utility;
public class SimpleResourceAddAttributePage extends WizardPage {
createAttributeColumns(attTblViewer);
- // make lines and header visible
+ // Make lines and header visible
Table table = attTblViewer.getTable();
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
table.setHeaderVisible(true);
return;
}
AttributeHelper att = (AttributeHelper) e;
- if (att.getValidValuesType() != Type.RANGE) {
+ if (att.getValidValuesType() != ValidValuesType.RANGE) {
cell.setText("Nil");
} else {
String min = att.getMin();
return;
}
AttributeHelper att = (AttributeHelper) e;
- if (att.getValidValuesType() != Type.VALUESET) {
+ if (att.getValidValuesType() != ValidValuesType.VALUESET) {
cell.setText("Nil");
} else {
cell.setText(att.getAllowedValues().toString());
return;
}
// Opening the dialog for edit operation.
- // Passing the attribute to pre-fill the UI controls.
+ // Passing the attribute to populate UI controls with data.
Set<String> rTypes = Utility.getAttributeTypes();
AddAttributeDialog dialog = new AddAttributeDialog(Display
.getDefault().getActiveShell(), att, rTypes, attributes);
att.setAllowedValues(newAtt.getAllowedValues());
}
attTblViewer.update(att, null);
- System.out.println("Attribute data after closing edit dialog: "
- + att);
}
});
IStructuredSelection selection = (IStructuredSelection) attTblViewer
.getSelection();
if (null != selection) {
- System.out.println(selection.size());
Iterator<?> itr = selection.iterator();
while (itr.hasNext()) {
AttributeHelper att = (AttributeHelper) itr.next();
- System.out.println(att.getAttributeName());
attTblViewer.remove(att);
attributes.remove(att);
AttributeContentProvider provider = (AttributeContentProvider) attTblViewer
@Override
public void selectionChanged(SelectionChangedEvent event) {
- System.out.println("table selection changed");
remBtn.setEnabled(true);
IStructuredSelection selection = (IStructuredSelection) event
.getSelection();