Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Launch shortcuts work from scratchpad too

Remove redundant code from scratchpad
  • Loading branch information...
commit e9b93ef1ee13b4905069f331f3f1e3a3edd43cb0 1 parent 0278bcd
@jakobc jakobc authored
View
49 org.erlide.ui/src/org/erlide/ui/editors/scratchpad/ErlangScratchPad.java
@@ -26,8 +26,6 @@
import org.eclipse.jface.text.information.IInformationProviderExtension2;
import org.eclipse.jface.text.information.InformationPresenter;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.projection.ProjectionSupport;
import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.search.ui.IContextMenuConstants;
import org.eclipse.swt.custom.StyledText;
@@ -58,7 +56,6 @@
import org.erlide.ui.actions.OpenAction;
import org.erlide.ui.editors.erl.AbstractErlangEditor;
import org.erlide.ui.editors.erl.ColorManager;
-import org.erlide.ui.editors.erl.ErlangEditor;
import org.erlide.ui.editors.erl.ErlangEditorMessages;
import org.erlide.ui.editors.erl.ErlangSourceViewerConfiguration;
import org.erlide.ui.editors.erl.IErlangEditorActionDefinitionIds;
@@ -77,7 +74,6 @@
private ColorManager colorManager;
private InformationPresenter fInformationPresenter;
- private ProjectionSupport fProjectionSupport;
private IErlangFoldingStructureProvider fProjectionModelUpdater;
private CompositeActionGroup fActionGroups;
private CompositeActionGroup fContextMenuGroup;
@@ -183,51 +179,6 @@ public void createPartControl(final Composite parent) {
}
@Override
- protected ISourceViewer createSourceViewer(final Composite parent,
- final IVerticalRuler ruler, final int styles) {
- final ISourceViewer viewer = new ProjectionViewer(parent, ruler,
- getOverviewRuler(), true, styles);
- getSourceViewerDecorationSupport(viewer);
-
- /*
- * This is a performance optimization to reduce the computation of the
- * text presentation triggered by {@link #setVisibleDocument(IDocument)}
- */
- // if (javaSourceViewer != null && isFoldingEnabled() && (store == null
- // ||
- // !store.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS)))
- // javaSourceViewer.prepareDelayedProjection();
- if (ErlangEditor.isFoldingEnabled()) {
- final ProjectionViewer projectionViewer = (ProjectionViewer) viewer;
- fProjectionSupport = new ProjectionSupport(projectionViewer,
- getAnnotationAccess(), getSharedColors());
- fProjectionSupport
- .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
- fProjectionSupport
- .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
- // TODO fProjectionSupport.setHoverControlCreator(new
- // IInformationControlCreator()
- // {
- // public IInformationControl createInformationControl(Shell shell)
- // {
- // return new CustomSourceInformationControl(shell,
- // IDocument.DEFAULT_CONTENT_TYPE);
- // }
- // });
-
- fProjectionSupport.install();
-
- fProjectionModelUpdater = ErlideUIPlugin.getDefault()
- .getFoldingStructureProviderRegistry()
- .getCurrentFoldingProvider();
- if (fProjectionModelUpdater != null) {
- fProjectionModelUpdater.install(this, projectionViewer);
- }
- }
- return viewer;
- }
-
- @Override
protected void createActions() {
super.createActions();
// ActionGroup oeg, ovg, jsg;
View
26 org.erlide.ui/src/org/erlide/ui/launch/ErlangNodeLaunchShortcut.java
@@ -42,7 +42,6 @@
import org.erlide.model.root.IErlProject;
import org.erlide.model.util.ModelUtils;
import org.erlide.ui.editors.erl.AbstractErlangEditor;
-import org.erlide.ui.editors.erl.ErlangEditor;
import org.erlide.utils.ErlLogger;
import org.erlide.utils.ListsUtils;
import org.erlide.utils.StringUtils;
@@ -113,21 +112,18 @@ public int compare(final IErlProject o1, final IErlProject o2) {
@Override
public void launch(final IEditorPart editor, final String mode) {
ErlLogger.debug("** Launch :: " + editor.getTitle());
- if (editor instanceof ErlangEditor) {
+ if (editor instanceof AbstractErlangEditor) {
final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) editor;
- final IErlModule module = erlangEditor.getModule();
- if (module != null) {
- final IErlProject project = ModelUtils.getProject(module);
- if (project != null) {
- try {
- doLaunch(mode, Lists.newArrayList(project));
- } catch (final CoreException e) {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- final Shell shell = workbench
- .getActiveWorkbenchWindow().getShell();
- MessageDialog.openError(shell, "Error", e.getStatus()
- .getMessage());
- }
+ final IErlProject project = erlangEditor.getProject();
+ if (project != null) {
+ try {
+ doLaunch(mode, Lists.newArrayList(project));
+ } catch (final CoreException e) {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ final Shell shell = workbench.getActiveWorkbenchWindow()
+ .getShell();
+ MessageDialog.openError(shell, "Error", e.getStatus()
+ .getMessage());
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.