Skip to content

Commit

Permalink
method moved to super
Browse files Browse the repository at this point in the history
  • Loading branch information
nicity committed Nov 29, 2013
1 parent bd77694 commit bc0401c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 35 deletions.
12 changes: 8 additions & 4 deletions src/com/advancedtools/cpp/actions/CompileCppAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected List<String> defaultAppendOptions(CompileCppOptions options, List<Stri
abstract String getOutputFileName(VirtualFile file, CompileCppOptions compileOptions);
}

static class ClangCompileHandler extends CompileHandler {
public static class ClangCompileHandler extends CompileHandler {
private @NonNls Map<String, String> myItems;

@Nullable List<String> buildCommand(VirtualFile file, CompileCppOptions options) {
Expand All @@ -95,9 +95,13 @@ Map<String, String> getCommandLineProperties() {
return myItems;
}

public static String getMatchingPattern() {
return "^((?:\\w\\:)?[^\\:]+)(?:\\:([0-9]+)\\:(?:([0-9])+\\:))";
}

@Nullable
Filter getCompileLogFilter(VirtualFile file, CompileCppOptions options) {
return new MakeBuildHandler.MakeFormatFilter(file, options.getProject());
return new BasicFormatFilter(file, options.getProject(), getMatchingPattern());
}

String buildProjectCompileOptions(Project project) {
Expand Down Expand Up @@ -325,7 +329,7 @@ public void update(AnActionEvent e) {
static class CompileCppDialog extends DialogWrapper {
private JPanel myPanel;
private JTextField compileProperties;
private JComboBox compilerSelector;
private JComboBox<CppSupportSettings.CompilerSelectOptions> compilerSelector;
private JCheckBox includeProjectCompileParametersCheckBox;
private JTextField projectCompileParameters;
private JCheckBox doRun;
Expand Down Expand Up @@ -360,7 +364,7 @@ public void itemStateChanged(ItemEvent e) {

setTitle(CppBundle.message("compile.cpp.file.dialog.title"));

compilerSelector.setModel(new DefaultComboBoxModel(CppSupportSettings.CompilerSelectOptions.values()));
compilerSelector.setModel(new DefaultComboBoxModel<CppSupportSettings.CompilerSelectOptions>(CppSupportSettings.CompilerSelectOptions.values()));
compilerSelector.setSelectedItem(getCurrentCompilerOption(project));

setSelectedProjectCompile();
Expand Down
27 changes: 13 additions & 14 deletions src/com/advancedtools/cpp/build/BasicFormatFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.fileEditor.FileEditor;
Expand All @@ -20,7 +19,7 @@
* Date: Mar 23, 2009
* Time: 10:47:14 PM
*/
abstract public class BasicFormatFilter implements Filter {
public class BasicFormatFilter implements Filter {
private final Pattern fileNameAndSizeExractor;
protected VirtualFile currentContext;
protected final Project project;
Expand Down Expand Up @@ -81,20 +80,18 @@ public void navigate(Project project) {
if (lineNumber != 0) {
final FileEditor[] fileEditors = FileEditorManager.getInstance(project).getEditors(child1);

if (fileEditors != null) {
Editor editor = null;
Editor editor = null;

for(FileEditor fe:fileEditors) {
if (fe instanceof TextEditor) {
editor = ((TextEditor)fe).getEditor();
break;
}
for(FileEditor fe:fileEditors) {
if (fe instanceof TextEditor) {
editor = ((TextEditor)fe).getEditor();
break;
}
}

if (editor != null) {
int offset = editor.getDocument().getLineStartOffset(lineNumber - 1) + (columnNumber != 0?columnNumber - 1:0);
new OpenFileDescriptor(project, child1,offset).navigate(true);
}
if (editor != null) {
int offset = editor.getDocument().getLineStartOffset(lineNumber - 1) + (columnNumber != 0?columnNumber - 1:0);
new OpenFileDescriptor(project, child1,offset).navigate(true);
}
}
}
Expand All @@ -107,5 +104,7 @@ public boolean isError() {
}
}

protected abstract VirtualFile resolveFilename(String fileName);
protected VirtualFile resolveFilename(String fileName) {
return VfsUtil.findRelativeFile(fileName, currentContext);
}
}
5 changes: 0 additions & 5 deletions src/com/advancedtools/cpp/build/MakeBuildHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VfsUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.NonNls;
Expand Down Expand Up @@ -60,10 +59,6 @@ public MakeFormatFilter(VirtualFile file, Project project) {
public static String getMatchingPattern() {
return "^((?:\\w\\:)?[^\\:]+)(?:\\:([0-9]+)\\:(?:([0-9])+\\:)?)?";
}

protected VirtualFile resolveFilename(String fileName) {
return VfsUtil.findRelativeFile(fileName, currentContext);
}
}

private static Pattern targetPattern = Pattern.compile("^(\\w+)\\:");
Expand Down
6 changes: 0 additions & 6 deletions src/com/advancedtools/cpp/build/NMakeBuildHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.execution.filters.Filter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -54,10 +52,6 @@ private static class MakeFormatFilter extends BasicFormatFilter {
public MakeFormatFilter(VirtualFile file, Project project) {
super(file, project, "^([^\\(]+)\\(([0-9]+)\\) \\: (?:warning|error|fatal error)");
}

protected VirtualFile resolveFilename(String fileName) {
return VfsUtil.findRelativeFile(fileName, currentContext);
}
}

public String[] getAvailableConfigurations() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.advancedtools.cpp.communicator.Communicator;
import com.intellij.execution.filters.Filter;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
Expand All @@ -24,7 +23,7 @@
*/
public class VisualStudioBuildHandler extends BaseBuildHandler {
private File tempOutFile;
private boolean stopReadThread;
private volatile boolean stopReadThread;

@NonNls
private static final String REBUILD_BUILD_ACTION = "Rebuild";
Expand Down Expand Up @@ -225,9 +224,5 @@ public static class VCFormatFilter extends BasicFormatFilter {
public VCFormatFilter(VirtualFile file, Project project) {
super(file, project, "^(?:[0-9]>)?([^\\(]+)\\(([0-9]+)\\) \\: (?:warning|error|fatal error)");
}

protected VirtualFile resolveFilename(String fileName) {
return VfsUtil.findRelativeFile(fileName, currentContext);
}
}
}

0 comments on commit bc0401c

Please sign in to comment.