-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quick-fix for extraneous empty line(s) in manifest editor (#564)
* quick-fix for extraneous empty line(s) in manifest editor Extraneous lines are errneous to the manifest compiler, but it does not recommend / provide a resolution. Add a quick fix to remove extraneous line. Fixes: #563 * fixup: fix the copyright header * fixup: address review comments 1. code formatting 2. updating the copyright header
- Loading branch information
1 parent
27ac47f
commit c5f499d
Showing
6 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
....eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/ExtraneousLinesResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 IBM Corporation and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
* Gireesh Punathil <gpunathi@in.ibm.com> Initial implementation | ||
*******************************************************************************/ | ||
package org.eclipse.pde.internal.ui.correction; | ||
|
||
import org.eclipse.core.resources.IMarker; | ||
import org.eclipse.jface.text.IDocument; | ||
import org.eclipse.jface.text.IRegion; | ||
import org.eclipse.pde.internal.core.text.bundle.BundleModel; | ||
import org.eclipse.pde.internal.ui.PDEUIMessages; | ||
|
||
/** | ||
* <p> | ||
* Represents a resolution to the problem of the bundle manifest having | ||
* extraneous lines. | ||
* </p> | ||
*/ | ||
public class ExtraneousLinesResolution extends AbstractManifestMarkerResolution { | ||
|
||
/** | ||
* Creates a new resolution | ||
* | ||
* @param type {@link AbstractPDEMarkerResolution#REMOVE_TYPE} to delete lines | ||
*/ | ||
public ExtraneousLinesResolution(int type, IMarker marker) { | ||
super(type, marker); | ||
} | ||
|
||
/** | ||
* Resolves the problem by extracting the empty line and removing it. | ||
*/ | ||
@Override | ||
protected void createChange(BundleModel model) { | ||
IDocument doc = model.getDocument(); | ||
try { | ||
int line = (int) marker.getAttribute("emptyLine"); //$NON-NLS-1$ | ||
IRegion l = doc.getLineInformation(line); | ||
doc.replace(l.getOffset(), l.getLength() + 1, ""); //$NON-NLS-1$ | ||
} catch (Exception e) { | ||
} | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return PDEUIMessages.ExtraneousLineResolutionRemove_description; | ||
} | ||
|
||
@Override | ||
public String getLabel() { | ||
return PDEUIMessages.ExtraneousLineResolutionRemove_label; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters