This repository has been archived by the owner on Apr 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'LangEclipseIDE/master'
Conflicts: plugin_ide.core/src/LANG_PROJECT_ID/ide/core/bundle_model/LANGUAGE_BundleModelManager.java
- Loading branch information
Showing
15 changed files
with
252 additions
and
35 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
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
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
30 changes: 30 additions & 0 deletions
30
plugin_ide.ui/src-lang/melnorme/lang/ide/ui/actions/RunUIOperationAction.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,30 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2015 Bruno Medeiros and other Contributors. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Bruno Medeiros - initial API and implementation | ||
*******************************************************************************/ | ||
package melnorme.lang.ide.ui.actions; | ||
|
||
import org.eclipse.jface.action.Action; | ||
|
||
public class RunUIOperationAction extends Action { | ||
|
||
protected final AbstractUIOperation operation; | ||
|
||
public RunUIOperationAction(AbstractUIOperation operation) { | ||
this.operation = operation; | ||
|
||
setText(operation.getOperationName()); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
operation.executeAndHandle(); | ||
} | ||
|
||
} |
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
89 changes: 89 additions & 0 deletions
89
plugin_ide.ui/src-lang/melnorme/lang/ide/ui/operations/RunToolOperation.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,89 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2015 Bruno Medeiros and other Contributors. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Bruno Medeiros - initial API and implementation | ||
*******************************************************************************/ | ||
package melnorme.lang.ide.ui.operations; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
|
||
import melnorme.lang.ide.core.LangCore; | ||
import melnorme.lang.ide.core.LangCoreMessages; | ||
import melnorme.lang.ide.core.operations.AbstractToolManager; | ||
import melnorme.lang.ide.core.operations.AbstractToolManager.RunProcessTask; | ||
import melnorme.lang.ide.core.operations.MessageEventInfo; | ||
import melnorme.lang.ide.core.operations.OperationInfo; | ||
import melnorme.lang.ide.core.utils.TextMessageUtils; | ||
import melnorme.lang.ide.ui.actions.AbstractUIOperation; | ||
import melnorme.utilbox.collections.Indexable; | ||
import melnorme.utilbox.concurrency.OperationCancellation; | ||
import melnorme.utilbox.core.CommonException; | ||
|
||
public abstract class RunToolOperation extends AbstractUIOperation { | ||
|
||
protected final IProject project; | ||
protected final Indexable<String> commands; | ||
|
||
public RunToolOperation(String operationName, IProject project, Indexable<String> commands) { | ||
super(operationName); | ||
this.project = project; | ||
this.commands = commands; | ||
} | ||
|
||
protected AbstractToolManager getToolManager() { | ||
return LangCore.getToolManager(); | ||
} | ||
|
||
@Override | ||
protected void doBackgroundComputation(IProgressMonitor monitor) | ||
throws CoreException, CommonException, OperationCancellation { | ||
ProcessBuilder pb = createProcessBuilder(); | ||
|
||
OperationInfo opInfo = getToolManager().startNewToolOperation(); | ||
|
||
getToolManager().notifyMessageEvent(new MessageEventInfo(opInfo, | ||
TextMessageUtils.headerBIG(getOperationStartMessage()))); | ||
|
||
RunProcessTask runToolTask = getToolManager().newRunToolTask(opInfo, pb, monitor); | ||
runProcessTask(runToolTask); | ||
} | ||
|
||
protected String getOperationStartMessage() { | ||
return LangCoreMessages.RunningCommand; | ||
} | ||
|
||
protected ProcessBuilder createProcessBuilder() throws CoreException, CommonException { | ||
return AbstractToolManager.createProcessBuilder(project, getCommands()); | ||
} | ||
|
||
protected void runProcessTask(RunProcessTask runToolTask) throws CommonException, OperationCancellation { | ||
runToolTask.runProcess(); | ||
} | ||
|
||
protected String[] getCommands() { | ||
return commands.toArray(String.class); | ||
} | ||
|
||
/* ----------------- ----------------- */ | ||
|
||
public abstract static class RunSDKToolOperation extends RunToolOperation { | ||
|
||
public RunSDKToolOperation(String operationName, IProject project, Indexable<String> commands) { | ||
super(operationName, project, commands); | ||
} | ||
|
||
@Override | ||
protected ProcessBuilder createProcessBuilder() throws CoreException, CommonException { | ||
return getToolManager().createSDKProcessBuilder(project, getCommands()); | ||
} | ||
|
||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
plugin_tooling/src-lang/melnorme/lang/utils/EventSource.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,40 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2015 Bruno Medeiros and other Contributors. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Bruno Medeiros - initial API and implementation | ||
*******************************************************************************/ | ||
package melnorme.lang.utils; | ||
|
||
|
||
import melnorme.utilbox.collections.Indexable; | ||
import melnorme.utilbox.fields.IEventSource; | ||
import melnorme.utilbox.fields.ListenerListHelper; | ||
|
||
public class EventSource<T> implements IEventSource<T> { | ||
|
||
protected final ListenerListHelper<T> listeners = new ListenerListHelper<>(); | ||
|
||
public EventSource() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public void addListener(T listener) { | ||
listeners.addListener(listener); | ||
} | ||
|
||
@Override | ||
public void removeListener(T listener) { | ||
listeners.removeListener(listener); | ||
} | ||
|
||
protected Indexable<T> getListeners() { | ||
return listeners.getListeners(); | ||
} | ||
|
||
} |
Oops, something went wrong.