Skip to content

Commit

Permalink
Format java files in o.e.equinox.security.ui
Browse files Browse the repository at this point in the history
This was achieved by running:
eclipse -consolelog -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter \
  -config .settings/org.eclipse.jdt.core.prefs . -data `mktemp -d`

Signed-off-by: Torbjörn SVENSSON <[email protected]>
  • Loading branch information
Torbjorn-Svensson committed Oct 12, 2023
1 parent 3f01e84 commit f1bd6a4
Show file tree
Hide file tree
Showing 28 changed files with 264 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,43 @@
import org.eclipse.ui.IWorkbenchWindow;

/**
* The AuthorizationManager is the facility by which the end user
* is informed of the current state of the system with respect to
* bundle authorization based security.
* The AuthorizationManager is the facility by which the end user is informed of
* the current state of the system with respect to bundle authorization based
* security.
*/
public abstract class AuthorizationManager {

public AuthorizationManager() {
//no content
// no content
}

/**
* Query whether the authorization system is enabled for the system.
*
* @return <code>true</code> if and only if authorization is enabled
* @return <code>true</code> if and only if authorization is enabled
*/
abstract public boolean isEnabled();

/**
* Returns true when the system is in need of attention from the end
* user. This means that some unauthorized content has been encountered, and the
* user has not yet inspected the situation.
* Returns true when the system is in need of attention from the end user. This
* means that some unauthorized content has been encountered, and the user has
* not yet inspected the situation.
*
* @return <code>true</code> if user attention is required
*/
abstract public boolean needsAttention();

/**
* Return an Eclipse IStatus object representing the current state of the
* Return an Eclipse IStatus object representing the current state of the
* authorization system.
*
* @return IStatus code representing the system status
*/
abstract public IStatus getStatus();

/**
* Open the authorization manager user interface so that the end
* user can view and edit the system's authorization state.
* Open the authorization manager user interface so that the end user can view
* and edit the system's authorization state.
*
* @param workbenchWindow the workbench window
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,26 @@ public abstract class SecurityContributionItemFactory {
private final String contributionItemId;

/**
* Creates a new contribution item factory with the given id.
* @param contributionItemId the id of contribution items created by this factory
*/
* Creates a new contribution item factory with the given id.
*
* @param contributionItemId the id of contribution items created by this
* factory
*/
protected SecurityContributionItemFactory(String contributionItemId) {
this.contributionItemId = contributionItemId;
}

/**
* Returns the id of this contribution item factory.
*
* @return the id of contribution items created by this factory
*/
public String getId() {
return contributionItemId;
}

/**
* Workbench contribution item (id &quot;securityStatus&quot;): An icon for
* Workbench contribution item (id &quot;securityStatus&quot;): An icon for
* evaluating and inspecting the security status of the system.
*/
public static final ContributionItemFactory SECURITY_STATUS = new ContributionItemFactory("securityStatus") {//$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
/**
* X500PrincipalHelper
* <p>
* Helper class to extract pieces (attributes) of an X500Principal object for display
* in the UI.
* Helper class to extract pieces (attributes) of an X500Principal object for
* display in the UI.
* <p>
* This helper uses the X500Principal.RFC2253 format of X500Principal.getname() to parse an X500Principal name
* into it's component parts.
* <p>
* In principals which contain multiple occurrences of the same attribute,the default for all the methods
* is to return the most significant (first) attribute found.
*
* This helper uses the X500Principal.RFC2253 format of X500Principal.getname()
* to parse an X500Principal name into it's component parts.
* <p>
* In principals which contain multiple occurrences of the same attribute,the
* default for all the methods is to return the most significant (first)
* attribute found.
*
*/

public class X500PrincipalHelper {
Expand Down Expand Up @@ -60,20 +61,21 @@ public X500PrincipalHelper(X500Principal principal) {
}

/**
* Set the X500Principal name object to be parsed.
* <p>
* Set the X500Principal name object to be parsed.
* <p>

Check warning on line 65 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @param principal - X500Principal
*/
public void setPrincipal(X500Principal principal) {
parseDN(principal.getName(X500Principal.RFC2253));
}

/**
* Gets the most significant common name (CN) attribute from the given
* X500Principal object.
* For names that contains multiple attributes of this type. The first
* (most significant) one will be returned
* <p>
* Gets the most significant common name (CN) attribute from the given
* X500Principal object. For names that contains multiple attributes of this
* type. The first (most significant) one will be returned
* <p>

Check warning on line 77 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @return the Most significant common name attribute.
*
*/
Expand All @@ -82,11 +84,10 @@ public String getCN() {
}

/**
* Gets the most significant Organizational Unit (OU) attribute from the given
* X500Principal object.
* For names that contains multiple attributes of this type. The first
* (most significant) one will be returned
* <p>
* Gets the most significant Organizational Unit (OU) attribute from the given
* X500Principal object. For names that contains multiple attributes of this
* type. The first (most significant) one will be returned
* <p>

Check warning on line 90 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @return the Most significant OU attribute.
*
Expand All @@ -98,11 +99,10 @@ public String getOU() {
}

/**
* Gets the most significant Organization (O) attribute from the given
* X500Principal object.
* For names that contains multiple attributes of this type. The first
* (most significant) one will be returned
* <p>
* Gets the most significant Organization (O) attribute from the given
* X500Principal object. For names that contains multiple attributes of this
* type. The first (most significant) one will be returned
* <p>

Check warning on line 105 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @return the Most significant O attribute.
*
Expand All @@ -114,9 +114,8 @@ public String getO() {
}

/**
* Gets the Country (C) attribute from the given
* X500Principal object.
* <p>
* Gets the Country (C) attribute from the given X500Principal object.
* <p>

Check warning on line 118 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @return the C attribute.
*
Expand All @@ -126,9 +125,8 @@ public String getC() {
}

/**
* Gets the Locale (L) attribute from the given
* X500Principal object.
* <p>
* Gets the Locale (L) attribute from the given X500Principal object.
* <p>

Check warning on line 129 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @return the L attribute.
*
Expand All @@ -138,9 +136,8 @@ public String getL() {
}

/**
* Gets the State (ST) attribute from the given
* X500Principal object.
* <p>
* Gets the State (ST) attribute from the given X500Principal object.
* <p>

Check warning on line 140 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @return the ST attribute.
*
Expand All @@ -150,9 +147,8 @@ public String getST() {
}

/**
* Gets the Street (STREET) attribute from the given
* X500Principal object.
* <p>
* Gets the Street (STREET) attribute from the given X500Principal object.
* <p>

Check warning on line 151 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @return the STREET attribute.
*
Expand All @@ -162,9 +158,9 @@ public String getSTREET() {
}

/**
* Gets the Email Address (EMAILADDRESS) attribute from the given
* X500Principal object.
* <p>
* Gets the Email Address (EMAILADDRESS) attribute from the given X500Principal
* object.
* <p>

Check warning on line 163 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
*
* @return the EMAILADDRESS attribute.
*
Expand All @@ -180,8 +176,8 @@ public String getUID() {
/**
* Derived From: org.eclipse.osgi.internal.verifier - DNChainMatching.java
*
* Takes a distinguished name in canonical form and fills in the rdnArray
* with the extracted RDNs.
* Takes a distinguished name in canonical form and fills in the rdnArray with
* the extracted RDNs.
*
* @param dn the distinguished name in canonical form.
* @throws IllegalArgumentException if a formatting error is found.
Expand Down Expand Up @@ -228,12 +224,14 @@ private void parseDN(String dn) throws IllegalArgumentException {
}

/**
* Returns an ArrayList containing all the values for the given attribute identifier.
* Returns an ArrayList containing all the values for the given attribute
* identifier.
* <p>

Check warning on line 229 in bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java

View check run for this annotation

Jenkins - Eclipse Equinox / JavaDoc

-

NORMAL: tag empty
* @param attributeID String containing the X500 name attribute whose values are to be
* returned
* @return ArrayList containing the string values of the requested attribute. Values are in
* the order they occur. May be empty.
*
* @param attributeID String containing the X500 name attribute whose values are
* to be returned
* @return ArrayList containing the string values of the requested attribute.
* Values are in the order they occur. May be empty.
*
*/
public ArrayList<String> getAllValues(String attributeID) {
Expand All @@ -244,7 +242,8 @@ public ArrayList<String> getAllValues(String attributeID) {
String namePart = nameList.get(0);

if (namePart.startsWith(searchPart)) {
// Return the string starting after the ID string and the = sign that follows it.
// Return the string starting after the ID string and the = sign that follows
// it.
retList.add(namePart.toString().substring(searchPart.length()));
}
}
Expand All @@ -265,9 +264,10 @@ private String findSignificantPart(String attributeID, int significance) {
String namePart = nameList.get(0);

if (namePart.startsWith(searchPart)) {
// Return the string starting after the ID string and the = sign that follows it.
// Return the string starting after the ID string and the = sign that follows
// it.
retNamePart = namePart.toString().substring(searchPart.length());
// By definition the first one is most significant
// By definition the first one is most significant
if (significance == MOSTSIGNIFICANT)
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);

TabFolder tabFolder = new TabFolder(composite, SWT.BORDER);
GridData bdata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
GridData bdata = new GridData(
GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
tabFolder.setLayoutData(bdata);

createBasicTab(tabFolder);
Expand Down Expand Up @@ -177,7 +178,8 @@ private void createBasicTab(TabFolder tabFolder) {
basicTab.setControl(basicTabComposite);
}

protected static void configureLayout(Control c, int horizontalSpan, int verticalSpan, int horizontalIndent, int vertIndent) {
protected static void configureLayout(Control c, int horizontalSpan, int verticalSpan, int horizontalIndent,
int vertIndent) {
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER);

gd.horizontalSpan = horizontalSpan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public boolean isEnabled() {

@Override
public boolean needsAttention() {
return needsAttention; //TODO: make it happen
return needsAttention; // TODO: make it happen
}

@Override
Expand All @@ -51,23 +51,23 @@ public IStatus getStatus() {

@Override
public void displayManager(IWorkbenchWindow workbenchWindow) {
//TODO: manager UI
// TODO: manager UI
}

private IStatus transformStatus(int engineStatus) {
Status status = null;
switch (engineStatus) {
case AuthorizationStatus.OK :
status = new Status(IStatus.OK, Activator.getSymbolicName(), ""); //$NON-NLS-1$ //TODO: text
break;
case AuthorizationStatus.OK:
status = new Status(IStatus.OK, Activator.getSymbolicName(), ""); //$NON-NLS-1$ //TODO: text
break;

case AuthorizationStatus.ERROR :
status = new Status(IStatus.ERROR, Activator.getSymbolicName(), ""); //$NON-NLS-1$ //TODO: text
break;
case AuthorizationStatus.ERROR:
status = new Status(IStatus.ERROR, Activator.getSymbolicName(), ""); //$NON-NLS-1$ //TODO: text
break;

default :
status = null;
break;
default:
status = null;
break;
}
return status;
}
Expand Down
Loading

0 comments on commit f1bd6a4

Please sign in to comment.