diff options
author | rbrooks | 2010-07-24 17:38:31 +0000 |
---|---|---|
committer | rbrooks | 2010-07-24 17:38:31 +0000 |
commit | 4081f04850d3eff9eb1bd7241763707bfbb43a45 (patch) | |
tree | 258620df94d4b24077ff103a6c4dea9cb78493fb /plugins/org.eclipse.osee.framework.ui.admin | |
parent | 4ed8bddc791fda93940f238c5135556a07041dc0 (diff) | |
download | org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.gz org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.xz org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.zip |
applied Eclipse source cleanup
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.admin')
14 files changed, 530 insertions, 479 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminAction.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminAction.java index c9a4e4e8a5f..0accc218236 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminAction.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminAction.java @@ -24,26 +24,30 @@ import org.eclipse.ui.PlatformUI; */ public class AdminAction implements IWorkbenchWindowActionDelegate { + @Override public void run(IAction proxyAction) { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { page.showView(AdminView.VIEW_ID); } catch (PartInitException e1) { MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Launch Error", - "Couldn't Launch Admin View " + e1.getMessage()); + "Couldn't Launch Admin View " + e1.getMessage()); } } // IActionDelegate method + @Override public void selectionChanged(IAction proxyAction, ISelection selection) { } // IWorkbenchWindowActionDelegate method + @Override public void init(IWorkbenchWindow window) { } // IWorkbenchWindowActionDelegate method + @Override public void dispose() { // nothing to do } diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminPlugin.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminPlugin.java index 9bf53202b1a..d101b2ad150 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminPlugin.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminPlugin.java @@ -33,6 +33,7 @@ public class AdminPlugin extends OseeUiActivator { /** * This method is called upon plug-in activation */ + @Override public void start(BundleContext context) throws Exception { super.start(context); } diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminView.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminView.java index 606b514cf17..41f8f86e3e3 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminView.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/AdminView.java @@ -48,7 +48,7 @@ import org.eclipse.ui.part.ViewPart; /** * Allows administration of access for OSEE environment <li>Database tables <li>OSEE user permissions - * + * * @author Jeff C. Phillips */ @@ -142,16 +142,16 @@ public class AdminView extends ViewPart implements IActionable { public void handleBroadcastMessage() { EntryDialog ed = - new EntryDialog(Displays.getActiveShell(), "Broadcast Message to OSEE Instantiations", null, - "Enter Message", MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0); + new EntryDialog(Displays.getActiveShell(), "Broadcast Message to OSEE Instantiations", null, "Enter Message", + MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0); if (ed.open() == 0) { String message = ed.getEntry(); if (!message.equals("")) { if (MessageDialog.openConfirm(Displays.getActiveShell(), "Broadcast Message", - "Broadcast message\n\n\"" + message + "\"\n\nAre you sure?")) { + "Broadcast message\n\n\"" + message + "\"\n\nAre you sure?")) { try { OseeEventManager.kickBroadcastEvent(this, new BroadcastEvent(BroadcastEventType.Message, null, - message)); + message)); AWorkbench.popup("Success", "Message sent."); } catch (Exception ex) { OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex); @@ -162,11 +162,10 @@ public class AdminView extends ViewPart implements IActionable { } public void handlePing() { - if (MessageDialog.openConfirm(Displays.getActiveShell(), "Ping OSEE Instantiations?", - "Ping OSEE Instantiations?")) { + if (MessageDialog.openConfirm(Displays.getActiveShell(), "Ping OSEE Instantiations?", "Ping OSEE Instantiations?")) { try { OseeEventManager.kickBroadcastEvent(this, new BroadcastEvent(BroadcastEventType.Ping, null, - ClientSessionManager.getSession().toString())); + ClientSessionManager.getSession().toString())); AWorkbench.popup("Success", "Ping Sent"); } catch (Exception ex) { OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex); @@ -231,6 +230,7 @@ public class AdminView extends ViewPart implements IActionable { } } + @Override public String getActionDescription() { String desc = ""; TabItem items[] = tabFolder.getSelection(); diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/Group.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/Group.java index f1c06097075..3335820736e 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/Group.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/Group.java @@ -15,8 +15,8 @@ package org.eclipse.osee.framework.ui.admin; */ public class Group { - private int groupId; - private String groupName; + private final int groupId; + private final String groupName; private int childrenSize; private int numChildrenChecked; @@ -92,7 +92,9 @@ public class Group { * @return boolean, true if all the children are checked else false */ public boolean isAllChecked() { - if (numChildrenChecked == childrenSize) return true; + if (numChildrenChecked == childrenSize) { + return true; + } return false; } @@ -100,7 +102,9 @@ public class Group { * @return boolean, true if none of the children are checked else false */ public boolean isAllEmpty() { - if (numChildrenChecked == 0) return true; + if (numChildrenChecked == 0) { + return true; + } return false; } diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/OseeClientsTab.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/OseeClientsTab.java index f161cdf6333..c694bc34105 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/OseeClientsTab.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/OseeClientsTab.java @@ -55,227 +55,233 @@ import org.eclipse.ui.PlatformUI; public class OseeClientsTab { - private final User whoAmI; - private final List<User> users; - private CheckboxTreeViewer peopleCheckboxTreeViewer; - private Composite mainComposite; - private Text text; - - public OseeClientsTab(TabFolder tabFolder) throws OseeCoreException { - super(); - this.users = UserManager.getUsersSortedByName(); - this.whoAmI = UserManager.getUser(); - users.remove(whoAmI); - this.mainComposite = null; - createControl(tabFolder); - mainComposite.setEnabled(isUserAllowedToOperate()); - } - - private void createControl(TabFolder tabFolder) throws OseeCoreException { - mainComposite = new Composite(tabFolder, SWT.NONE); - mainComposite.setLayout(new GridLayout()); - mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - TabItem tab = new TabItem(tabFolder, SWT.NONE); - tab.setControl(mainComposite); - tab.setText("OSEE Clients"); - - Group group = new Group(mainComposite, SWT.NONE); - group.setLayout(new GridLayout()); - group.setText("Issue Shutdown Request"); - group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - if (isUserAllowedToOperate()) { - SashForm sashForm = new SashForm(group, SWT.NONE); - sashForm.setLayout(new GridLayout()); - sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - createUserSelectionArea(sashForm); - createMessageArea(sashForm); - } else { - createDefaultWarning(group); - } - } - - private void createMessageArea(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - Group group = new Group(composite, SWT.NONE); - group.setLayout(new GridLayout()); - group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - group.setText("Enter Reason for Shutdown -- THIS WILL BE DISPLAYED TO THE SELECTED USERS --"); - - text = new Text(group, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL); - text.setEditable(true); - GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); - gd.heightHint = 100; - text.setLayoutData(gd); - - Button button = new Button(composite, SWT.NONE); - button.setText("Send Shutdown Request"); - button.setToolTipText("By pressing the send button, a shutdown message will be sent to\n" + "all the selected OSEE clients causing their workbench to close.\n" + "NOTE: Users will be prompted to save their work."); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - processShutdownRequest(text.getText(), getSelectedUsers()); - } - }); - - Composite blankComposite = new Composite(composite, SWT.NONE); - blankComposite.setLayout(new GridLayout()); - blankComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - } - - public static Control createDefaultWarning(Composite parent) { - Composite composite = new Composite(parent, SWT.BORDER); - composite.setLayout(new GridLayout(2, false)); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - composite.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); - - Label image = new Label(composite, SWT.NONE); - image.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, true)); - image.setImage(ImageManager.getImage(FrameworkImage.LOCKED_KEY)); - image.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); - - Label label = new Label(composite, SWT.NONE); - Font font = new Font(PlatformUI.getWorkbench().getDisplay(), "Courier New", 10, SWT.BOLD); - label.setFont(font); - label.setForeground(Displays.getSystemColor(SWT.COLOR_DARK_RED)); - label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, true)); - label.setText("Access Denied.\nContact your administrator."); - label.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); - - return composite; - } - - private void processShutdownRequest(String reason, Collection<User> selectedUsers) { - if (Strings.isValid(reason) && !selectedUsers.isEmpty()) { - boolean result = - MessageDialog.openConfirm(mainComposite.getShell(), "Disconnect OSEE Clients", - "Are you sure you want to shutdown the selected OSEE clients?"); - if (false != result) { - try { - OseeEventManager.kickBroadcastEvent(this, new BroadcastEvent(BroadcastEventType.Force_Shutdown, - selectedUsers, reason)); - AWorkbench.popup("Success", "Shutdown request sent."); - } catch (Exception ex) { - OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex); - } - } - } else { - StringBuilder error = new StringBuilder(); - error.append("Unable to process request.\n"); - if (reason == null || reason.length() <= 0) { - error.append(" A reason must be entered before a client can be requested to shutdown.\n"); - } - if (selectedUsers.isEmpty()) { - error.append(" At least 1 user must be selected.\n"); - } - MessageDialog.openError(mainComposite.getShell(), "Disconnect OSEE Clients", error.toString()); - } - } - - private boolean isUserAllowedToOperate() throws OseeCoreException { - return AccessControlManager.isOseeAdmin(); - } - - private Collection<User> getSelectedUsers() { - Set<User> toReturn = new HashSet<User>(); - try { - Object[] checked = peopleCheckboxTreeViewer.getCheckedElements(); - for (Object object : checked) { - if (false != peopleCheckboxTreeViewer.getChecked(object)) { - toReturn.add((User) object); - } - } - } catch (Exception ex) { - OseeLog.log(AdminPlugin.class, OseeLevel.SEVERE_POPUP, ex); - } - return toReturn; - } - - private void createUserSelectionArea(Composite parent) { - Group group = new Group(parent, SWT.NONE); - group.setLayout(new GridLayout()); - group.setText("Select Users to Shutdown"); - - peopleCheckboxTreeViewer = - new CheckboxTreeViewer(group, SWT.BORDER | SWT.MULTI | SWT.CHECK | SWT.V_SCROLL | SWT.H_SCROLL); - peopleCheckboxTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - peopleCheckboxTreeViewer.setContentProvider(new TreeContentProvider()); - peopleCheckboxTreeViewer.setLabelProvider(new PersonLabelProvider()); - peopleCheckboxTreeViewer.setInput(users); - Composite composite = new Composite(group, SWT.NONE); - composite.setLayout(new GridLayout(2, true)); - - Button selectAll = new Button(composite, SWT.PUSH); - selectAll.setText("Select All"); - selectAll.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - selectAll(true); - } - }); - - Button deselectAll = new Button(composite, SWT.PUSH); - deselectAll.setText("Deselect All"); - deselectAll.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - selectAll(false); - } - }); - } - - private void selectAll(boolean isSelectAll) { - Object[] objects = peopleCheckboxTreeViewer.getExpandedElements(); - for (Object object : objects) { - peopleCheckboxTreeViewer.setSubtreeChecked(object, isSelectAll); - } - } - - private static class TreeContentProvider implements ITreeContentProvider { - - public void dispose() { - // Nothing to dispose - } - - public void inputChanged(Viewer arg0, Object arg1, Object arg2) { - // Nothing to change - } - - public Object[] getChildren(Object parentElement) { - return null; - } - - public Object getParent(Object element) { - return null; - } - - public boolean hasChildren(Object element) { - return false; - } - - @SuppressWarnings("unchecked") - public Object[] getElements(Object inputElement) { - return ((ArrayList) inputElement).toArray(); - } - } - - private static class PersonLabelProvider extends LabelProvider { - - @Override - public Image getImage(Object arg0) { - return null; - } - - @Override - public String getText(Object arg0) { - return ((User) arg0).getName(); - } - } + private final User whoAmI; + private final List<User> users; + private CheckboxTreeViewer peopleCheckboxTreeViewer; + private Composite mainComposite; + private Text text; + + public OseeClientsTab(TabFolder tabFolder) throws OseeCoreException { + super(); + this.users = UserManager.getUsersSortedByName(); + this.whoAmI = UserManager.getUser(); + users.remove(whoAmI); + this.mainComposite = null; + createControl(tabFolder); + mainComposite.setEnabled(isUserAllowedToOperate()); + } + + private void createControl(TabFolder tabFolder) throws OseeCoreException { + mainComposite = new Composite(tabFolder, SWT.NONE); + mainComposite.setLayout(new GridLayout()); + mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + TabItem tab = new TabItem(tabFolder, SWT.NONE); + tab.setControl(mainComposite); + tab.setText("OSEE Clients"); + + Group group = new Group(mainComposite, SWT.NONE); + group.setLayout(new GridLayout()); + group.setText("Issue Shutdown Request"); + group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + if (isUserAllowedToOperate()) { + SashForm sashForm = new SashForm(group, SWT.NONE); + sashForm.setLayout(new GridLayout()); + sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + createUserSelectionArea(sashForm); + createMessageArea(sashForm); + } else { + createDefaultWarning(group); + } + } + + private void createMessageArea(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + Group group = new Group(composite, SWT.NONE); + group.setLayout(new GridLayout()); + group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + group.setText("Enter Reason for Shutdown -- THIS WILL BE DISPLAYED TO THE SELECTED USERS --"); + + text = new Text(group, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL); + text.setEditable(true); + GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); + gd.heightHint = 100; + text.setLayoutData(gd); + + Button button = new Button(composite, SWT.NONE); + button.setText("Send Shutdown Request"); + button.setToolTipText("By pressing the send button, a shutdown message will be sent to\n" + "all the selected OSEE clients causing their workbench to close.\n" + "NOTE: Users will be prompted to save their work."); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + processShutdownRequest(text.getText(), getSelectedUsers()); + } + }); + + Composite blankComposite = new Composite(composite, SWT.NONE); + blankComposite.setLayout(new GridLayout()); + blankComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + } + + public static Control createDefaultWarning(Composite parent) { + Composite composite = new Composite(parent, SWT.BORDER); + composite.setLayout(new GridLayout(2, false)); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + composite.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); + + Label image = new Label(composite, SWT.NONE); + image.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, true)); + image.setImage(ImageManager.getImage(FrameworkImage.LOCKED_KEY)); + image.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); + + Label label = new Label(composite, SWT.NONE); + Font font = new Font(PlatformUI.getWorkbench().getDisplay(), "Courier New", 10, SWT.BOLD); + label.setFont(font); + label.setForeground(Displays.getSystemColor(SWT.COLOR_DARK_RED)); + label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, true)); + label.setText("Access Denied.\nContact your administrator."); + label.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); + + return composite; + } + + private void processShutdownRequest(String reason, Collection<User> selectedUsers) { + if (Strings.isValid(reason) && !selectedUsers.isEmpty()) { + boolean result = + MessageDialog.openConfirm(mainComposite.getShell(), "Disconnect OSEE Clients", + "Are you sure you want to shutdown the selected OSEE clients?"); + if (false != result) { + try { + OseeEventManager.kickBroadcastEvent(this, new BroadcastEvent(BroadcastEventType.Force_Shutdown, + selectedUsers, reason)); + AWorkbench.popup("Success", "Shutdown request sent."); + } catch (Exception ex) { + OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex); + } + } + } else { + StringBuilder error = new StringBuilder(); + error.append("Unable to process request.\n"); + if (reason == null || reason.length() <= 0) { + error.append(" A reason must be entered before a client can be requested to shutdown.\n"); + } + if (selectedUsers.isEmpty()) { + error.append(" At least 1 user must be selected.\n"); + } + MessageDialog.openError(mainComposite.getShell(), "Disconnect OSEE Clients", error.toString()); + } + } + + private boolean isUserAllowedToOperate() throws OseeCoreException { + return AccessControlManager.isOseeAdmin(); + } + + private Collection<User> getSelectedUsers() { + Set<User> toReturn = new HashSet<User>(); + try { + Object[] checked = peopleCheckboxTreeViewer.getCheckedElements(); + for (Object object : checked) { + if (false != peopleCheckboxTreeViewer.getChecked(object)) { + toReturn.add((User) object); + } + } + } catch (Exception ex) { + OseeLog.log(AdminPlugin.class, OseeLevel.SEVERE_POPUP, ex); + } + return toReturn; + } + + private void createUserSelectionArea(Composite parent) { + Group group = new Group(parent, SWT.NONE); + group.setLayout(new GridLayout()); + group.setText("Select Users to Shutdown"); + + peopleCheckboxTreeViewer = + new CheckboxTreeViewer(group, SWT.BORDER | SWT.MULTI | SWT.CHECK | SWT.V_SCROLL | SWT.H_SCROLL); + peopleCheckboxTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + peopleCheckboxTreeViewer.setContentProvider(new TreeContentProvider()); + peopleCheckboxTreeViewer.setLabelProvider(new PersonLabelProvider()); + peopleCheckboxTreeViewer.setInput(users); + Composite composite = new Composite(group, SWT.NONE); + composite.setLayout(new GridLayout(2, true)); + + Button selectAll = new Button(composite, SWT.PUSH); + selectAll.setText("Select All"); + selectAll.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + selectAll(true); + } + }); + + Button deselectAll = new Button(composite, SWT.PUSH); + deselectAll.setText("Deselect All"); + deselectAll.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + selectAll(false); + } + }); + } + + private void selectAll(boolean isSelectAll) { + Object[] objects = peopleCheckboxTreeViewer.getExpandedElements(); + for (Object object : objects) { + peopleCheckboxTreeViewer.setSubtreeChecked(object, isSelectAll); + } + } + + private static class TreeContentProvider implements ITreeContentProvider { + + @Override + public void dispose() { + // Nothing to dispose + } + + @Override + public void inputChanged(Viewer arg0, Object arg1, Object arg2) { + // Nothing to change + } + + @Override + public Object[] getChildren(Object parentElement) { + return null; + } + + @Override + public Object getParent(Object element) { + return null; + } + + @Override + public boolean hasChildren(Object element) { + return false; + } + + @Override + @SuppressWarnings("unchecked") + public Object[] getElements(Object inputElement) { + return ((ArrayList) inputElement).toArray(); + } + } + + private static class PersonLabelProvider extends LabelProvider { + + @Override + public Image getImage(Object arg0) { + return null; + } + + @Override + public String getText(Object arg0) { + return ((User) arg0).getName(); + } + } } diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbCellModifier.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbCellModifier.java index 7288a5827ba..a0e014e26f0 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbCellModifier.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbCellModifier.java @@ -50,6 +50,7 @@ public class DbCellModifier implements ICellModifier { /** * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String) */ + @Override public boolean canModify(Object element, String property) { return true; } @@ -57,6 +58,7 @@ public class DbCellModifier implements ICellModifier { /** * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String) */ + @Override public Object getValue(Object element, String property) { int columnIndex = dbTableViewer.getColumnNames().indexOf(property); @@ -70,7 +72,9 @@ public class DbCellModifier implements ICellModifier { enumeratedValue.setChoices(UserManager.getUserNames()); User u = null; u = UserManager.getUserByUserId((String) obj); - if (u != null) enumeratedValue.setValue(u.getName()); + if (u != null) { + enumeratedValue.setValue(u.getName()); + } } catch (Exception ex) { OseeLog.log(AdminPlugin.class, Level.SEVERE, ex); } @@ -79,7 +83,7 @@ public class DbCellModifier implements ICellModifier { stringValue.setValue(((String) obj)); return stringValue; } else if (obj == null) { - stringValue.setValue(("")); + stringValue.setValue(""); return stringValue; } return null; @@ -88,6 +92,7 @@ public class DbCellModifier implements ICellModifier { /** * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object) */ + @Override public void modify(Object element, String property, Object value) { // Find the index of the column diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbItem.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbItem.java index dc5579ffa59..2d8da06b6b6 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbItem.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbItem.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.framework.ui.admin.dbtabletab; - public abstract class DbItem { private final String tableName; @@ -20,7 +19,7 @@ public abstract class DbItem { } public boolean isWriteAccess() { - return true; + return true; } public String getTableName() { diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbLabelProvider.java index 88db6e5a526..6273cb3dc23 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbLabelProvider.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbLabelProvider.java @@ -27,50 +27,54 @@ import org.eclipse.swt.graphics.Image; */ public class DbLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider { - private final String[] columnNames; + private final String[] columnNames; - public DbLabelProvider(String[] columnNames) { - this.columnNames = columnNames; - }; + public DbLabelProvider(String[] columnNames) { + this.columnNames = columnNames; + }; - public Color getForeground(Object element, int columnIndex) { - DbModel model = (DbModel) element; - if (model.isColumnChanged(columnNames[columnIndex])) { - return Displays.getSystemColor(SWT.COLOR_RED); - } - return null; - } + @Override + public Color getForeground(Object element, int columnIndex) { + DbModel model = (DbModel) element; + if (model.isColumnChanged(columnNames[columnIndex])) { + return Displays.getSystemColor(SWT.COLOR_RED); + } + return null; + } - public Color getBackground(Object element, int columnIndex) { - return null; - } + @Override + public Color getBackground(Object element, int columnIndex) { + return null; + } - /** - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) - */ - public String getColumnText(Object element, int columnIndex) { - DbModel dbModel = (DbModel) element; - Object obj = dbModel.getColumn(columnIndex); - if (obj == null) { - return ""; - } else if (obj instanceof String) { - return (String) obj; - } else if (obj instanceof Long) { - return ((Long) obj).toString(); - } else if (obj instanceof Integer) { - return ((Integer) obj).toString(); - } else if (obj instanceof Timestamp) { - return ((Timestamp) obj).toString(); - } else { - return "Unknown column type"; - } - } + /** + * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) + */ + @Override + public String getColumnText(Object element, int columnIndex) { + DbModel dbModel = (DbModel) element; + Object obj = dbModel.getColumn(columnIndex); + if (obj == null) { + return ""; + } else if (obj instanceof String) { + return (String) obj; + } else if (obj instanceof Long) { + return ((Long) obj).toString(); + } else if (obj instanceof Integer) { + return ((Integer) obj).toString(); + } else if (obj instanceof Timestamp) { + return ((Timestamp) obj).toString(); + } else { + return "Unknown column type"; + } + } - /** - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) - */ - public Image getColumnImage(Object element, int columnIndex) { - return null; - } + /** + * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) + */ + @Override + public Image getColumnImage(Object element, int columnIndex) { + return null; + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbModel.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbModel.java index a96872cf6ad..5f08c85526d 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbModel.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbModel.java @@ -17,18 +17,19 @@ import java.util.ArrayList; */ public class DbModel { - private ArrayList<Object> columns = new ArrayList<Object>(); + private final ArrayList<Object> columns = new ArrayList<Object>(); private boolean needSave = false; - private ArrayList<String> changedColumns = new ArrayList<String>(); + private final ArrayList<String> changedColumns = new ArrayList<String>(); public DbModel() { } public Object getColumn(int num) { - if (columns.isEmpty() || num > columns.size()) + if (columns.isEmpty() || num > columns.size()) { return ""; - else + } else { return columns.get(num); + } } public void addColumn(int column, Object obj) { @@ -48,7 +49,9 @@ public class DbModel { } public void setColumnChanged(String column) { - if (column == null) changedColumns.clear(); + if (column == null) { + changedColumns.clear(); + } changedColumns.add(column); } @@ -60,11 +63,11 @@ public class DbModel { String[] values = new String[columns.size()]; int x = 0; for (Object o : columns) { - if (o instanceof String) + if (o instanceof String) { values[x] = (String) o; - else if (o instanceof Long) + } else if (o instanceof Long) { values[x] = ((Long) o).toString(); - else if (o == null) { + } else if (o == null) { values[x] = ""; } else { System.err.println("Invalid value type"); diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableSorter.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableSorter.java index 1c56551b06b..d22adf38827 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableSorter.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableSorter.java @@ -14,8 +14,8 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerSorter; /** - * Sorter for the WorldTableViewer that displays items of type <code>ExampleTask</code>. The sorter supports three - * sort criteria: + * Sorter for the WorldTableViewer that displays items of type <code>ExampleTask</code>. The sorter supports three sort + * criteria: * <p> * <code>DESCRIPTION</code>: Task description (String) * </p> @@ -31,7 +31,7 @@ import org.eclipse.jface.viewers.ViewerSorter; public class DbTableSorter extends ViewerSorter { // Criteria that the instance uses - private int criteria; + private final int criteria; /** * Creates a resource sorter that will use the given sort criteria. @@ -43,6 +43,7 @@ public class DbTableSorter extends ViewerSorter { this.criteria = criteria; } + @Override public int compare(Viewer viewer, Object o1, Object o2) { Object obj1 = ((DbModel) o1).getColumn(criteria); @@ -58,8 +59,12 @@ public class DbTableSorter extends ViewerSorter { @SuppressWarnings("unchecked") protected int compareStrings(String str1, String str2) { - if (str1 == null) str1 = ""; - if (str2 == null) str2 = ""; + if (str1 == null) { + str1 = ""; + } + if (str2 == null) { + str2 = ""; + } return getComparator().compare(str1, str2); } diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableTab.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableTab.java index dc8b46b3ecf..47efde06dcf 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableTab.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableTab.java @@ -35,179 +35,186 @@ import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; public class DbTableTab { - protected Browser browser; - public static final String VIEW_ID = "org.eclipse.osee.framework.ui.admin.AdminView"; - public static User person; - public static DbTableViewer dbTableViewer; - private static XCombo filterCombo; - private final Label readOnlyLabel, addRecordLabel, publishLabel; - private final ArrayList<DbItem> dbItems; - private final Cursor handCursor; - private boolean noListener = true; - private final Composite parent; - - public DbTableTab(TabFolder tabFolder) { - super(); - - dbItems = new ArrayList<DbItem>(); - dbItems.add(new SiteGssflRpcr()); - dbItems.add(new OseeInfoDbItem()); - handCursor = new Cursor(null, SWT.CURSOR_HAND); - - TabItem dbTab = new TabItem(tabFolder, SWT.NULL); - dbTab.setText("Database"); - - // Filter Composite - int numColumns = 5; - Composite c = new Composite(tabFolder, SWT.NONE); - c.setLayout(new GridLayout(numColumns, false)); - c.setLayoutData(new GridData()); - - c.setLayoutData(new GridData(GridData.FILL_BOTH)); - this.parent = c; - - filterCombo = new XCombo("DB Table", ""); - filterCombo.setDataStrings(getDbTableNames()); - filterCombo.createWidgets(c, 2); - filterCombo.addModifyListener(new ModifyListener() { - - public void modifyText(ModifyEvent e) { - try { - handleTableSelect(); - } catch (OseeDataStoreException ex) { - OseeLog.log(AdminPlugin.class, Level.SEVERE, ex); - } - AdminView.setSaveNeeded(false); - } - }); - - readOnlyLabel = new Label(c, SWT.NONE); - readOnlyLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED)); - - addRecordLabel = new Label(c, SWT.NONE); - addRecordLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLUE)); - addRecordLabel.addMouseTrackListener(new MouseTrackListener() { - - public void mouseEnter(MouseEvent e) { - if (getSelectedDbItem() != null && getSelectedDbItem().isWriteAccess()) { - if (addRecordLabel != null) { - addRecordLabel.setCursor(handCursor); - } - } - } - - public void mouseExit(MouseEvent e) { - if (addRecordLabel != null) { - addRecordLabel.setCursor(null); - } - }; - - public void mouseHover(MouseEvent e) { - } - }); - - publishLabel = new Label(c, SWT.NONE); - publishLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLUE)); - publishLabel.addMouseTrackListener(new MouseTrackListener() { - - @Override - public void mouseEnter(MouseEvent e) { - if (getSelectedDbItem() != null && getSelectedDbItem().isWriteAccess()) { - if (publishLabel != null) { - publishLabel.setCursor(handCursor); - } - } - } - - public void mouseExit(MouseEvent e) { - if (publishLabel != null) { - publishLabel.setCursor(null); - } - }; - - public void mouseHover(MouseEvent e) { - } - }); - - updateReadOnly(); - dbTab.setControl(c); - } - - Listener addRecordListener = new Listener() { - public void handleEvent(org.eclipse.swt.widgets.Event event) { - System.out.println("I am adding a row..."); - handleAddRecord(); - }; - }; - - public void handleAddRecord() { - System.out.println("trying to add a record"); - dbTableViewer.addRecord(); - } - - public void updateReadOnly() { - DbItem selItem = getSelectedDbItem(); - if (selItem == null) { - readOnlyLabel.setText(""); - addRecordLabel.setText(" "); - } else if (selItem.isWriteAccess()) { - readOnlyLabel.setText(" WRITE ACCESS"); - addRecordLabel.setText(" Add Record "); - - if (noListener) { - addRecordLabel.addListener(SWT.MouseUp, addRecordListener); - } - noListener = false; - } else { - readOnlyLabel.setText(" READ ONLY ACCESS"); - addRecordLabel.setText(" "); - addRecordLabel.removeListener(SWT.MouseUp, addRecordListener); - } - } - - public DbItem getSelectedDbItem() { - for (DbItem d : dbItems) { - if (filterCombo.get().equals(d.getTableName())) { - return d; - } - } - return null; - } - - public void handleTableSelect() throws OseeDataStoreException { - if (dbTableViewer != null) { - dbTableViewer.dispose(); - } - updateReadOnly(); - if (filterCombo.get().equals("")) { - return; - } - - dbTableViewer = new DbTableViewer(parent, 5, this, getSelectedDbItem()); - dbTableViewer.load(); - parent.layout(); - } - - public static void refresh() throws OseeDataStoreException { - if (filterCombo.get().equals("")) { - return; - } - if (dbTableViewer != null) { - dbTableViewer.load(); - dbTableViewer.refresh(); - } - } - - public XCombo getFilterCombo() { - return filterCombo; - } - - public String[] getDbTableNames() { - String names[] = new String[dbItems.size()]; - for (int x = 0; x < dbItems.size(); x++) { - names[x] = dbItems.get(x).getTableName(); - } - return names; - } + protected Browser browser; + public static final String VIEW_ID = "org.eclipse.osee.framework.ui.admin.AdminView"; + public static User person; + public static DbTableViewer dbTableViewer; + private static XCombo filterCombo; + private final Label readOnlyLabel, addRecordLabel, publishLabel; + private final ArrayList<DbItem> dbItems; + private final Cursor handCursor; + private boolean noListener = true; + private final Composite parent; + + public DbTableTab(TabFolder tabFolder) { + super(); + + dbItems = new ArrayList<DbItem>(); + dbItems.add(new SiteGssflRpcr()); + dbItems.add(new OseeInfoDbItem()); + handCursor = new Cursor(null, SWT.CURSOR_HAND); + + TabItem dbTab = new TabItem(tabFolder, SWT.NULL); + dbTab.setText("Database"); + + // Filter Composite + int numColumns = 5; + Composite c = new Composite(tabFolder, SWT.NONE); + c.setLayout(new GridLayout(numColumns, false)); + c.setLayoutData(new GridData()); + + c.setLayoutData(new GridData(GridData.FILL_BOTH)); + this.parent = c; + + filterCombo = new XCombo("DB Table", ""); + filterCombo.setDataStrings(getDbTableNames()); + filterCombo.createWidgets(c, 2); + filterCombo.addModifyListener(new ModifyListener() { + + @Override + public void modifyText(ModifyEvent e) { + try { + handleTableSelect(); + } catch (OseeDataStoreException ex) { + OseeLog.log(AdminPlugin.class, Level.SEVERE, ex); + } + AdminView.setSaveNeeded(false); + } + }); + + readOnlyLabel = new Label(c, SWT.NONE); + readOnlyLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED)); + + addRecordLabel = new Label(c, SWT.NONE); + addRecordLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLUE)); + addRecordLabel.addMouseTrackListener(new MouseTrackListener() { + + @Override + public void mouseEnter(MouseEvent e) { + if (getSelectedDbItem() != null && getSelectedDbItem().isWriteAccess()) { + if (addRecordLabel != null) { + addRecordLabel.setCursor(handCursor); + } + } + } + + @Override + public void mouseExit(MouseEvent e) { + if (addRecordLabel != null) { + addRecordLabel.setCursor(null); + } + }; + + @Override + public void mouseHover(MouseEvent e) { + } + }); + + publishLabel = new Label(c, SWT.NONE); + publishLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLUE)); + publishLabel.addMouseTrackListener(new MouseTrackListener() { + + @Override + public void mouseEnter(MouseEvent e) { + if (getSelectedDbItem() != null && getSelectedDbItem().isWriteAccess()) { + if (publishLabel != null) { + publishLabel.setCursor(handCursor); + } + } + } + + @Override + public void mouseExit(MouseEvent e) { + if (publishLabel != null) { + publishLabel.setCursor(null); + } + }; + + @Override + public void mouseHover(MouseEvent e) { + } + }); + + updateReadOnly(); + dbTab.setControl(c); + } + + Listener addRecordListener = new Listener() { + @Override + public void handleEvent(org.eclipse.swt.widgets.Event event) { + System.out.println("I am adding a row..."); + handleAddRecord(); + }; + }; + + public void handleAddRecord() { + System.out.println("trying to add a record"); + dbTableViewer.addRecord(); + } + + public void updateReadOnly() { + DbItem selItem = getSelectedDbItem(); + if (selItem == null) { + readOnlyLabel.setText(""); + addRecordLabel.setText(" "); + } else if (selItem.isWriteAccess()) { + readOnlyLabel.setText(" WRITE ACCESS"); + addRecordLabel.setText(" Add Record "); + + if (noListener) { + addRecordLabel.addListener(SWT.MouseUp, addRecordListener); + } + noListener = false; + } else { + readOnlyLabel.setText(" READ ONLY ACCESS"); + addRecordLabel.setText(" "); + addRecordLabel.removeListener(SWT.MouseUp, addRecordListener); + } + } + + public DbItem getSelectedDbItem() { + for (DbItem d : dbItems) { + if (filterCombo.get().equals(d.getTableName())) { + return d; + } + } + return null; + } + + public void handleTableSelect() throws OseeDataStoreException { + if (dbTableViewer != null) { + dbTableViewer.dispose(); + } + updateReadOnly(); + if (filterCombo.get().equals("")) { + return; + } + + dbTableViewer = new DbTableViewer(parent, 5, this, getSelectedDbItem()); + dbTableViewer.load(); + parent.layout(); + } + + public static void refresh() throws OseeDataStoreException { + if (filterCombo.get().equals("")) { + return; + } + if (dbTableViewer != null) { + dbTableViewer.load(); + dbTableViewer.refresh(); + } + } + + public XCombo getFilterCombo() { + return filterCombo; + } + + public String[] getDbTableNames() { + String names[] = new String[dbItems.size()]; + for (int x = 0; x < dbItems.size(); x++) { + names[x] = dbItems.get(x).getTableName(); + } + return names; + } } diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableViewer.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableViewer.java index bd0a482c5f8..95405780f75 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableViewer.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTableViewer.java @@ -177,8 +177,8 @@ public class DbTableViewer { */ private void createTable(Composite parent, int numColumns) { table = - new Table(parent, - SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); + new Table(parent, + SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL); gridData.horizontalSpan = numColumns; table.setLayoutData(gridData); @@ -265,6 +265,7 @@ public class DbTableViewer { tableViewer.setSorter(new DbTableSorter(0)); table.addListener(SWT.MouseDoubleClick, new Listener() { + @Override public void handleEvent(Event event) { TableItem[] items = table.getSelection(); if (items != null && items.length > 0) { @@ -273,8 +274,8 @@ public class DbTableViewer { if (item.getBounds(index).contains(event.x, event.y)) { Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); CellTextDialog dialog = - new CellTextDialog(shell, getAdminView().getSelectedDbItem().getTableName(), - table.getColumn(index).getText(), item.getText(index)); + new CellTextDialog(shell, getAdminView().getSelectedDbItem().getTableName(), table.getColumn( + index).getText(), item.getText(index)); dialog.open(); break; } @@ -301,6 +302,7 @@ public class DbTableViewer { */ class ExampleContentProvider implements IStructuredContentProvider, ITaskListViewer { + @Override public void inputChanged(Viewer v, Object oldInput, Object newInput) { if (newInput != null) { ((DbTaskList) newInput).addChangeListener(this); @@ -310,23 +312,28 @@ public class DbTableViewer { } } + @Override public void dispose() { dbTaskList.removeChangeListener(this); } // Return the tasks as an array of Objects + @Override public Object[] getElements(Object parent) { return dbTaskList.getTasks().toArray(); } + @Override public void addTask(DbModel task) { tableViewer.add(task); } + @Override public void removeTask(DbModel task) { tableViewer.remove(task); } + @Override public void updateTask(DbModel task) { tableViewer.update(task, null); } @@ -363,8 +370,8 @@ public class DbTableViewer { public CellTextDialog(Shell parentShell, String dialogTitle, String dialogMessage, String dialogText) { super(parentShell, dialogTitle, PlatformUI.getWorkbench().getSharedImages().getImage( - ISharedImages.IMG_OBJS_INFO_TSK), dialogMessage, MessageDialog.INFORMATION, - new String[] {IDialogConstants.OK_LABEL}, 0); + ISharedImages.IMG_OBJS_INFO_TSK), dialogMessage, MessageDialog.INFORMATION, + new String[] {IDialogConstants.OK_LABEL}, 0); this.dialogMessage = dialogText; this.setShellStyle(this.getShellStyle() | SWT.RESIZE); } diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTaskList.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTaskList.java index 481bb3e560a..608b40a5ceb 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTaskList.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/DbTaskList.java @@ -17,8 +17,8 @@ import java.util.Vector; public class DbTaskList { - private Vector<DbModel> tasks = new Vector<DbModel>(); - private Set<ITaskListViewer> changeListeners = new HashSet<ITaskListViewer>(); + private final Vector<DbModel> tasks = new Vector<DbModel>(); + private final Set<ITaskListViewer> changeListeners = new HashSet<ITaskListViewer>(); /** * Constructor @@ -40,8 +40,9 @@ public class DbTaskList { public void addTask(DbModel model) { tasks.add(tasks.size(), model); Iterator<ITaskListViewer> iterator = changeListeners.iterator(); - while (iterator.hasNext()) + while (iterator.hasNext()) { iterator.next().addTask(model); + } } /** @@ -50,10 +51,12 @@ public class DbTaskList { public void removeTask(DbModel task) { tasks.remove(task); Iterator<ITaskListViewer> iterator = changeListeners.iterator(); - while (iterator.hasNext()) + while (iterator.hasNext()) { iterator.next().removeTask(task); + } } + @Override public String toString() { String str = ""; for (int i = 0; i < tasks.size(); i++) { @@ -68,8 +71,9 @@ public class DbTaskList { */ public void taskChanged(DbModel task) { Iterator<ITaskListViewer> iterator = changeListeners.iterator(); - while (iterator.hasNext()) + while (iterator.hasNext()) { iterator.next().updateTask(task); + } } /** diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/SiteGssflRpcr.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/SiteGssflRpcr.java index 7b5cce130ca..1c9e69cc5cc 100644 --- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/SiteGssflRpcr.java +++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/SiteGssflRpcr.java @@ -38,14 +38,16 @@ public class SiteGssflRpcr extends DbItem { @Override public int getColumnWidth(String columnName) { - if (columnName.equals("DIRECTORY")) return 400; + if (columnName.equals("DIRECTORY")) { + return 400; + } return 100; } public boolean exists(String program) { try { return ConnectionHandler.runPreparedQueryFetchInt(0, - "SELECT count(1) FROM " + getTableName() + " WHERE PROGRAM = ?", returnTic(program)) > 0; + "SELECT count(1) FROM " + getTableName() + " WHERE PROGRAM = ?", returnTic(program)) > 0; } catch (OseeDataStoreException ex) { OseeLog.log(AdminPlugin.class, Level.SEVERE, ex); return false; |